@instructure/platform-notebook 1.8.0 → 1.9.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,14 +1,14 @@
1
- import { jsx as i, jsxs as C, Fragment as dt } from "react/jsx-runtime";
2
- import { createContext as ze, useMemo as me, useContext as qe, useReducer as Ke, useRef as _, useEffect as j, useState as U, useCallback as K } from "react";
1
+ import { jsx as i, jsxs as x, Fragment as dt } from "react/jsx-runtime";
2
+ import { createContext as ze, useMemo as me, useContext as qe, useReducer as Ke, useRef as F, useEffect as W, useState as j, useCallback as q } from "react";
3
3
  import { createPortal as ut } from "react-dom";
4
4
  import { z as f } from "zod";
5
5
  import ft from "diff-match-patch";
6
6
  import { useQueryClient as xe, useMutation as Re, useQuery as mt } from "@tanstack/react-query";
7
7
  import { CloseButton as gt, Button as te, IconButton as ue } from "@instructure/ui-buttons";
8
- import { Flex as x } from "@instructure/ui-flex";
8
+ import { Flex as R } from "@instructure/ui-flex";
9
9
  import { Heading as Ne } from "@instructure/ui-heading";
10
10
  import { Tray as ht } from "@instructure/ui-tray";
11
- import { View as Q } from "@instructure/ui-view";
11
+ import { View as X } from "@instructure/ui-view";
12
12
  import { IconQuestionLine as ke, IconPinLine as we, IconWarningLine as pt, IconNoteLine as yt, IconEditLine as ve, IconTrashLine as ye, IconArrowStartLine as Nt } from "@instructure/ui-icons";
13
13
  import { Menu as ce } from "@instructure/ui-menu";
14
14
  import { TruncateText as Ie } from "@instructure/ui-truncate-text";
@@ -35,7 +35,7 @@ const vt = f.object({
35
35
  range: vt.nullable(),
36
36
  pageLastModifiedAt: f.string()
37
37
  });
38
- var A = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(A || {});
38
+ var L = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(L || {});
39
39
  const Le = f.enum([
40
40
  "Important",
41
41
  "Confusing"
@@ -122,17 +122,17 @@ class ne {
122
122
  return o.setStart(e.node, e.offset), o.setEnd(n.node, n.offset), o;
123
123
  }
124
124
  static fromRange(e) {
125
- const n = X.fromPoint(e.startContainer, e.startOffset), o = X.fromPoint(e.endContainer, e.endOffset);
125
+ const n = K.fromPoint(e.startContainer, e.startOffset), o = K.fromPoint(e.endContainer, e.endOffset);
126
126
  return !n || !o ? null : new ne(n, o);
127
127
  }
128
128
  static fromOffsets(e, n, o) {
129
- return new ne(new X(e, n), new X(e, o));
129
+ return new ne(new K(e, n), new K(e, o));
130
130
  }
131
131
  relativeTo(e) {
132
132
  return new ne(this.start.relativeTo(e), this.end.relativeTo(e));
133
133
  }
134
134
  }
135
- class X {
135
+ class K {
136
136
  constructor(e, n) {
137
137
  n < 0 && console.error("Offset is invalid"), this.element = e, this.offset = n;
138
138
  }
@@ -154,9 +154,9 @@ class X {
154
154
  static fromCharOffset(e, n) {
155
155
  switch (e.nodeType) {
156
156
  case Node.TEXT_NODE:
157
- return X.fromPoint(e, n);
157
+ return K.fromPoint(e, n);
158
158
  case Node.ELEMENT_NODE:
159
- return new X(e, n);
159
+ return new K(e, n);
160
160
  default:
161
161
  return console.error("Node is not an element or text node"), null;
162
162
  }
@@ -169,7 +169,7 @@ class X {
169
169
  if (!e.parentElement)
170
170
  return console.error("Text node has no parent"), null;
171
171
  const o = Ge(e) + n;
172
- return new X(e.parentElement, o);
172
+ return new K(e.parentElement, o);
173
173
  }
174
174
  case Node.ELEMENT_NODE: {
175
175
  if (n < 0 || n > e.childNodes.length)
@@ -177,7 +177,7 @@ class X {
177
177
  let o = 0;
178
178
  for (let r = 0; r < n; r++)
179
179
  o += Ye(e.childNodes[r]);
180
- return new X(e, o);
180
+ return new K(e, o);
181
181
  }
182
182
  default:
183
183
  return console.error("Point is not in an element or text node"), null;
@@ -189,7 +189,7 @@ class X {
189
189
  let n = this.element, o = this.offset;
190
190
  for (; n !== e; )
191
191
  o += Ge(n), n.parentElement && (n = n.parentElement);
192
- return new X(n, o);
192
+ return new K(n, o);
193
193
  }
194
194
  }
195
195
  const wt = (t) => {
@@ -269,7 +269,7 @@ class ie {
269
269
  const r = He(n.endContainer, e);
270
270
  if (!r)
271
271
  return console.error("Failed to resolve endContainer XPath"), null;
272
- const s = X.fromCharOffset(o, n.startOffset), l = X.fromCharOffset(r, n.endOffset);
272
+ const s = K.fromCharOffset(o, n.startOffset), l = K.fromCharOffset(r, n.endOffset);
273
273
  if (!s || !l)
274
274
  return null;
275
275
  const a = new ne(s, l).toRange();
@@ -352,10 +352,10 @@ const Ye = (t) => {
352
352
  const p = r.match_main(s, a, o), d = p + a.length;
353
353
  if (c === -1 || p === -1)
354
354
  return null;
355
- const g = d - c, S = Math.abs(g - m);
356
- if ((c > d || S > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(s, l, d), c !== -1 && c < d))
355
+ const h = d - c, E = Math.abs(h - m);
356
+ if ((c > d || E > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(s, l, d), c !== -1 && c < d))
357
357
  return Pt(t, c, d, m);
358
- if (c < d && S <= 5)
358
+ if (c < d && E <= 5)
359
359
  return oe.fromSelector(t, {
360
360
  start: c,
361
361
  end: d
@@ -428,11 +428,11 @@ const Ye = (t) => {
428
428
  if (!e.length)
429
429
  return null;
430
430
  const n = e[0], o = e[e.length - 1], r = 4, s = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (y) => {
431
- const T = y + he;
432
- return y >= s && T <= l - s;
431
+ const S = y + he;
432
+ return y >= s && S <= l - s;
433
433
  }, c = (y) => {
434
- const T = y + ge;
435
- return y >= s && T <= a - s;
434
+ const S = y + ge;
435
+ return y >= s && S <= a - s;
436
436
  };
437
437
  let p;
438
438
  const d = n.right - he;
@@ -443,19 +443,19 @@ const Ye = (t) => {
443
443
  if (m(y))
444
444
  p = y;
445
445
  else {
446
- const h = (n.left + n.right) / 2 - he / 2;
447
- m(h) ? p = h : d < s ? p = s : p = l - he - s;
446
+ const g = (n.left + n.right) / 2 - he / 2;
447
+ m(g) ? p = g : d < s ? p = s : p = l - he - s;
448
448
  }
449
449
  }
450
- let g;
451
- const S = o.bottom + r;
452
- if (c(S))
453
- g = S;
450
+ let h;
451
+ const E = o.bottom + r;
452
+ if (c(E))
453
+ h = E;
454
454
  else {
455
455
  const y = n.top - ge - r;
456
- c(y) ? g = y : S + ge > a - s ? g = a - ge - s : g = s;
456
+ c(y) ? h = y : E + ge > a - s ? h = a - ge - s : h = s;
457
457
  }
458
- return { top: g, left: p };
458
+ return { top: h, left: p };
459
459
  }, Ht = (t, e) => {
460
460
  for (const n of e)
461
461
  if (t.start < n.end && t.end > n.start)
@@ -503,44 +503,44 @@ const Ye = (t) => {
503
503
  Qt(e, n);
504
504
  return;
505
505
  }
506
- const l = e.type === A.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : De(l, 0.5), c = e.type === A.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, p = e.type === A.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
506
+ const l = e.type === L.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : De(l, 0.5), c = e.type === L.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, p = e.type === L.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
507
507
  d.id = `${r}-start`, d.className = "highlight-marker-start", d.dataset.highlightId = o || "";
508
- const g = e.labelPrefix ?? zt;
509
- d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label", g), d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && d.setAttribute("aria-current", "true"), e.popupId && d.setAttribute("aria-controls", e.popupId), d.style.position = "relative", d.style.fontSize = "0", d.style.lineHeight = "0", d.style.width = "0", d.style.height = "0", d.style.margin = "0", d.style.padding = "0", d.style.border = "0", d.style.outline = "none";
510
- const S = document.createElement("span");
511
- S.id = Ze(o), S.className = "highlight-marker-end", S.dataset.highlightId = o || "";
508
+ const h = e.labelPrefix ?? zt;
509
+ d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label", h), d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && d.setAttribute("aria-current", "true"), e.popupId && d.setAttribute("aria-controls", e.popupId), d.style.position = "relative", d.style.fontSize = "0", d.style.lineHeight = "0", d.style.width = "0", d.style.height = "0", d.style.margin = "0", d.style.padding = "0", d.style.border = "0", d.style.outline = "none";
510
+ const E = document.createElement("span");
511
+ E.id = Ze(o), E.className = "highlight-marker-end", E.dataset.highlightId = o || "";
512
512
  const y = t.cloneRange();
513
- y.collapse(!1), y.insertNode(S);
514
- const T = t.cloneRange();
515
- T.collapse(!0), T.insertNode(d);
516
- const h = document.createRange();
517
- h.setStartAfter(d), h.setEndBefore(S);
518
- const B = Kt(h).filter((N) => N.textContent && N.textContent.length > 0);
519
- B.forEach((N, v) => {
520
- var z;
521
- const P = N.parentElement;
522
- if ((P == null ? void 0 : P.dataset.highlightId) === o) return;
523
- const F = v === 0, b = v === B.length - 1, D = B.length === 1;
524
- let k;
525
- D ? k = "single" : F ? k = "first" : b ? k = "last" : k = "middle";
526
- const w = document.createElement("span");
527
- w.className = "highlight-content", w.dataset.highlightId = o || "", w.dataset.position = k, w.style.textDecorationLine = "underline", w.style.textDecorationColor = c, w.style.textDecorationStyle = p, w.style.textDecorationThickness = n.borderWidthSmall, w.style.textUnderlineOffset = n.underlineOffset, w.style.cursor = "pointer", et(w, a, m, c, p), w.addEventListener("click", (q) => {
513
+ y.collapse(!1), y.insertNode(E);
514
+ const S = t.cloneRange();
515
+ S.collapse(!0), S.insertNode(d);
516
+ const g = document.createRange();
517
+ g.setStartAfter(d), g.setEndBefore(E);
518
+ const G = Kt(g).filter((N) => N.textContent && N.textContent.length > 0);
519
+ G.forEach((N, C) => {
520
+ var _;
521
+ const D = N.parentElement;
522
+ if ((D == null ? void 0 : D.dataset.highlightId) === o) return;
523
+ const M = C === 0, P = C === G.length - 1, T = G.length === 1;
524
+ let A;
525
+ T ? A = "single" : M ? A = "first" : P ? A = "last" : A = "middle";
526
+ const v = document.createElement("span");
527
+ v.className = "highlight-content", v.dataset.highlightId = o || "", v.dataset.position = A, v.style.textDecorationLine = "underline", v.style.textDecorationColor = c, v.style.textDecorationStyle = p, v.style.textDecorationThickness = n.borderWidthSmall, v.style.textUnderlineOffset = n.underlineOffset, v.style.cursor = "pointer", et(v, a, m, c, p), v.addEventListener("click", (z) => {
528
528
  var Y;
529
- q.target.tagName !== "A" && ((Y = e.onClick) == null || Y.call(e));
530
- }), (z = N.parentNode) == null || z.insertBefore(w, N), w.appendChild(N);
529
+ z.target.tagName !== "A" && ((Y = e.onClick) == null || Y.call(e));
530
+ }), (_ = N.parentNode) == null || _.insertBefore(v, N), v.appendChild(N);
531
531
  }), d.addEventListener("click", (N) => {
532
- var v;
533
- N.target.tagName !== "A" && ((v = e.onClick) == null || v.call(e));
532
+ var C;
533
+ N.target.tagName !== "A" && ((C = e.onClick) == null || C.call(e));
534
534
  }), d.addEventListener("keydown", (N) => {
535
- var v;
535
+ var C;
536
536
  if (N.key === "Enter" || N.key === " ")
537
- N.preventDefault(), (v = e.onClick) == null || v.call(e);
537
+ N.preventDefault(), (C = e.onClick) == null || C.call(e);
538
538
  else if (N.key === "Tab" && !N.shiftKey) {
539
- const P = document.querySelectorAll(fe(o));
540
- for (const F of P) {
541
- const b = F.querySelector("a");
542
- if (b) {
543
- N.preventDefault(), b.focus();
539
+ const D = document.querySelectorAll(fe(o));
540
+ for (const M of D) {
541
+ const P = M.querySelector("a");
542
+ if (P) {
543
+ N.preventDefault(), P.focus();
544
544
  break;
545
545
  }
546
546
  }
@@ -548,19 +548,19 @@ const Ye = (t) => {
548
548
  }), d.addEventListener("focus", () => {
549
549
  document.querySelectorAll(
550
550
  `.highlight-content${fe(o)}`
551
- ).forEach((v) => {
552
- v.style.boxShadow = `0 0 0 ${Gt} ${n.colors.focusOutline}`, v.style.borderRadius = Ut;
551
+ ).forEach((C) => {
552
+ C.style.boxShadow = `0 0 0 ${Gt} ${n.colors.focusOutline}`, C.style.borderRadius = Ut;
553
553
  });
554
554
  }), d.addEventListener("blur", () => {
555
555
  document.querySelectorAll(
556
556
  `.highlight-content${fe(o)}`
557
- ).forEach((v) => {
558
- v.style.boxShadow = "", v.style.borderRadius = v.dataset.selected ? Je : "";
557
+ ).forEach((C) => {
558
+ C.style.boxShadow = "", C.style.borderRadius = C.dataset.selected ? Je : "";
559
559
  });
560
560
  });
561
561
  };
562
562
  function Qt(t, e) {
563
- const n = t.type === A.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : De(n, 0.5), s = t.type === A.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === A.IMPORTANT ? "solid" : "dashed";
563
+ const n = t.type === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground, o = t.id === t.selectedNoteId, r = o ? n : De(n, 0.5), s = t.type === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline, l = t.type === L.IMPORTANT ? "solid" : "dashed";
564
564
  document.querySelectorAll(
565
565
  `.highlight-content${fe(t.id ?? "")}`
566
566
  ).forEach((c) => {
@@ -763,7 +763,7 @@ function Eo({
763
763
  translate: c,
764
764
  children: p
765
765
  }) {
766
- const [d, g] = Ke(Un, Gn(a)), S = _(a != null), y = me(
766
+ const [d, h] = Ke(Un, Gn(a)), E = F(a != null), y = me(
767
767
  () => ({
768
768
  api: t,
769
769
  currentUserId: e,
@@ -772,14 +772,14 @@ function Eo({
772
772
  courseId: r,
773
773
  pageLastModifiedAt: s,
774
774
  ...d,
775
- selectNote: (T, h = !1) => g({ type: "SELECT_NOTE", payload: { id: T, isEditing: h } }),
776
- clearSelectedNote: () => g({ type: "CLEAR_SELECTED_NOTE" }),
777
- setEditing: (T) => g({ type: "SET_EDITING", payload: T }),
775
+ selectNote: (S, g = !1) => h({ type: "SELECT_NOTE", payload: { id: S, isEditing: g } }),
776
+ clearSelectedNote: () => h({ type: "CLEAR_SELECTED_NOTE" }),
777
+ setEditing: (S) => h({ type: "SET_EDITING", payload: S }),
778
778
  openTray: () => {
779
- S.current || (S.current = !0, l == null || l()), g({ type: "OPEN_TRAY" });
779
+ E.current || (E.current = !0, l == null || l()), h({ type: "OPEN_TRAY" });
780
780
  },
781
781
  closeTray: () => {
782
- S.current = !1, g({ type: "CLOSE_TRAY" });
782
+ E.current = !1, h({ type: "CLOSE_TRAY" });
783
783
  }
784
784
  }),
785
785
  [t, e, n, o, r, s, l, d]
@@ -802,8 +802,8 @@ const lt = "notebook-tray-content", So = ({ children: t }) => {
802
802
  onDismiss: n,
803
803
  placement: "end",
804
804
  size: "regular",
805
- children: /* @__PURE__ */ C(x, { direction: "column", height: "100vh", id: lt, children: [
806
- /* @__PURE__ */ i(x.Item, { children: /* @__PURE__ */ i(Q, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ C(x, { justifyItems: "space-between", alignItems: "center", children: [
805
+ children: /* @__PURE__ */ x(R, { direction: "column", height: "100vh", id: lt, children: [
806
+ /* @__PURE__ */ i(R.Item, { children: /* @__PURE__ */ i(X, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ x(R, { justifyItems: "space-between", alignItems: "center", children: [
807
807
  /* @__PURE__ */ i(Ne, { level: "h3", children: o.notebook }),
808
808
  /* @__PURE__ */ i(
809
809
  gt,
@@ -815,16 +815,16 @@ const lt = "notebook-tray-content", So = ({ children: t }) => {
815
815
  }
816
816
  )
817
817
  ] }) }) }),
818
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
818
+ /* @__PURE__ */ i(R.Item, { shouldGrow: !0, shouldShrink: !0, overflowY: "auto", overflowX: "hidden", children: t })
819
819
  ] })
820
820
  }
821
821
  );
822
822
  }, jn = ({ currentType: t, onSelectReaction: e }) => {
823
- const { translations: n } = V(), o = _(null), r = _(null);
824
- return j(() => {
825
- t === A.CONFUSING && o.current ? o.current.focus() : t === A.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
823
+ const { translations: n } = V(), o = F(null), r = F(null);
824
+ return W(() => {
825
+ t === L.CONFUSING && o.current ? o.current.focus() : t === L.IMPORTANT && r.current ? r.current.focus() : o.current && o.current.focus();
826
826
  }, [t]), /* @__PURE__ */ i(
827
- Q,
827
+ X,
828
828
  {
829
829
  as: "div",
830
830
  background: "primary",
@@ -832,23 +832,23 @@ const lt = "notebook-tray-content", So = ({ children: t }) => {
832
832
  borderColor: "secondary",
833
833
  borderRadius: "medium",
834
834
  shadow: "resting",
835
- children: /* @__PURE__ */ C(ce, { children: [
836
- /* @__PURE__ */ C(
835
+ children: /* @__PURE__ */ x(ce, { children: [
836
+ /* @__PURE__ */ x(
837
837
  ce.Item,
838
838
  {
839
839
  ref: o,
840
- onClick: () => e(A.CONFUSING),
840
+ onClick: () => e(L.CONFUSING),
841
841
  children: [
842
842
  /* @__PURE__ */ i(ke, { size: "x-small" }),
843
843
  ` ${n.markUnclear}`
844
844
  ]
845
845
  }
846
846
  ),
847
- /* @__PURE__ */ C(
847
+ /* @__PURE__ */ x(
848
848
  ce.Item,
849
849
  {
850
850
  ref: r,
851
- onClick: () => e(A.IMPORTANT),
851
+ onClick: () => e(L.IMPORTANT),
852
852
  children: [
853
853
  /* @__PURE__ */ i(we, { size: "x-small" }),
854
854
  ` ${n.markImportant}`
@@ -874,158 +874,158 @@ function To({
874
874
  objectType: c,
875
875
  courseId: p,
876
876
  pageLastModifiedAt: d,
877
- selectedNoteId: g,
878
- isTrayOpen: S,
877
+ selectedNoteId: h,
878
+ isTrayOpen: E,
879
879
  selectNote: y,
880
- openTray: T
881
- } = it(), { translations: h } = V(), { data: W } = nt({
880
+ openTray: S
881
+ } = it(), { translations: g } = V(), { data: Q } = nt({
882
882
  api: a,
883
883
  courseId: p,
884
884
  learningObject: { type: c, id: m }
885
- }), { mutate: B } = Vt(a), { mutateAsync: N } = en(a), { mutate: v } = Zt(a), P = _([]), [F, b] = U([]), [D, k] = U(null), [w, z] = U(""), [q, Y] = U(null), re = _(null);
886
- re.current = q;
887
- const [Z, J] = U(!1);
888
- j(() => {
889
- const R = t.current;
890
- if (!R) return;
891
- const I = R.closest(".user_content") ?? R;
885
+ }), { mutate: G } = Vt(a), { mutateAsync: N } = en(a), { mutate: C } = Zt(a), D = F([]), [M, P] = j([]), [T, A] = j(null), [v, _] = j(""), [z, Y] = j(null), re = F(null);
886
+ re.current = z;
887
+ const [Z, J] = j(!1);
888
+ W(() => {
889
+ const k = t.current;
890
+ if (!k) return;
891
+ const I = k.closest(".user_content") ?? k;
892
892
  if (I.classList.contains("enhanced")) {
893
893
  J(!0);
894
894
  return;
895
895
  }
896
- const M = new MutationObserver((u) => {
897
- for (const E of u)
898
- if (E.type === "attributes" && E.attributeName === "class" && E.target.classList.contains("enhanced")) {
899
- J(!0), M.disconnect();
896
+ const B = new MutationObserver((u) => {
897
+ for (const b of u)
898
+ if (b.type === "attributes" && b.attributeName === "class" && b.target.classList.contains("enhanced")) {
899
+ J(!0), B.disconnect();
900
900
  return;
901
901
  }
902
902
  });
903
- return M.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => M.disconnect();
903
+ return B.observe(I, { attributes: !0, attributeFilter: ["class"] }), () => B.disconnect();
904
904
  }, [t]);
905
- const G = K(() => {
906
- Y(null), k(null), z("");
905
+ const U = q(() => {
906
+ Y(null), A(null), _("");
907
907
  }, []);
908
- j(() => {
908
+ W(() => {
909
909
  if (!Z || !t.current) return;
910
910
  let I = null;
911
- const M = () => {
911
+ const B = () => {
912
912
  I && clearTimeout(I), I = setTimeout(() => {
913
913
  var Fe;
914
- const L = window.getSelection(), H = t.current;
915
- if (!(L != null && L.rangeCount) || !H) return;
916
- const le = L.toString().trim();
914
+ const O = window.getSelection(), H = t.current;
915
+ if (!(O != null && O.rangeCount) || !H) return;
916
+ const le = O.toString().trim();
917
917
  if (le === "") return;
918
- const ae = L.getRangeAt(0);
918
+ const ae = O.getRangeAt(0);
919
919
  if (!H.contains(ae.commonAncestorContainer)) return;
920
920
  const _e = (Fe = oe.fromRange(H, ae)) == null ? void 0 : Fe.toSelector();
921
- _e && !Ht(_e, F) && (k(ae.cloneRange()), z(le), Y($t(ae)));
921
+ _e && !Ht(_e, M) && (A(ae.cloneRange()), _(le), Y($t(ae)));
922
922
  }, n);
923
- }, u = (L) => {
924
- if (!(L.target instanceof Node)) return;
923
+ }, u = (O) => {
924
+ if (!(O.target instanceof Node)) return;
925
925
  const H = document.getElementById(Se);
926
- H != null && H.contains(L.target) ? (L.preventDefault(), L.stopImmediatePropagation()) : G();
927
- }, E = () => {
928
- G();
929
- }, O = (L) => {
930
- L.key === "Escape" && re.current !== null && (G(), L.stopImmediatePropagation());
926
+ H != null && H.contains(O.target) ? (O.preventDefault(), O.stopImmediatePropagation()) : U();
927
+ }, b = () => {
928
+ U();
929
+ }, w = (O) => {
930
+ O.key === "Escape" && re.current !== null && (U(), O.stopImmediatePropagation());
931
931
  };
932
- return document.addEventListener("selectionchange", M), document.addEventListener("mousedown", u), document.addEventListener("touchstart", u), document.addEventListener("keydown", O), window.addEventListener("scroll", E, !0), () => {
933
- I && clearTimeout(I), document.removeEventListener("selectionchange", M), document.removeEventListener("mousedown", u), document.removeEventListener("touchstart", u), document.removeEventListener("keydown", O), window.removeEventListener("scroll", E, !0);
932
+ return document.addEventListener("selectionchange", B), document.addEventListener("mousedown", u), document.addEventListener("touchstart", u), document.addEventListener("keydown", w), window.addEventListener("scroll", b, !0), () => {
933
+ I && clearTimeout(I), document.removeEventListener("selectionchange", B), document.removeEventListener("mousedown", u), document.removeEventListener("touchstart", u), document.removeEventListener("keydown", w), window.removeEventListener("scroll", b, !0);
934
934
  };
935
- }, [Z, F, n, t, G]);
936
- const se = K(
937
- (R) => {
935
+ }, [Z, M, n, t, U]);
936
+ const se = q(
937
+ (k) => {
938
938
  var H;
939
939
  const I = t.current;
940
- if (!I || !R.highlightData) return null;
941
- const { highlightData: M, reaction: u, id: E } = R, { range: O } = M, L = O && ((H = ie.fromSelector(I, O)) == null ? void 0 : H.toRange());
942
- if (L) {
943
- const le = u[0] === A.IMPORTANT ? h.important : h.unclear, ae = {
944
- id: E,
945
- selectedNoteId: g,
940
+ if (!I || !k.highlightData) return null;
941
+ const { highlightData: B, reaction: u, id: b } = k, { range: w } = B, O = w && ((H = ie.fromSelector(I, w)) == null ? void 0 : H.toRange());
942
+ if (O) {
943
+ const le = u[0] === L.IMPORTANT ? g.important : g.unclear, ae = {
944
+ id: b,
945
+ selectedNoteId: h,
946
946
  type: u[0],
947
- isTrayOpen: S,
948
- labelPrefix: `${h.notebookNote} (${le})`,
947
+ isTrayOpen: E,
948
+ labelPrefix: `${g.notebookNote} (${le})`,
949
949
  popupId: lt,
950
950
  onClick: () => {
951
- y(E), T();
951
+ y(b), S();
952
952
  }
953
953
  };
954
- return Xt(L, ae, e), M.textPosition;
954
+ return Xt(O, ae, e), B.textPosition;
955
955
  }
956
956
  return null;
957
957
  },
958
- [t, g, S, e, h, y, T]
958
+ [t, h, E, e, g, y, S]
959
959
  );
960
- j(() => {
961
- if (!Z || !W || !t.current) return;
962
- const R = t.current, I = W.notes, M = /* @__PURE__ */ new Set(), u = [], E = [];
960
+ W(() => {
961
+ if (!Z || !Q || !t.current) return;
962
+ const k = t.current, I = Q.notes, B = /* @__PURE__ */ new Set(), u = [], b = [];
963
963
  if (I.length === 0) {
964
- if (P.current.length > 0) {
965
- for (const O of P.current)
966
- Ue(O, R);
967
- P.current = [], b([]);
964
+ if (D.current.length > 0) {
965
+ for (const w of D.current)
966
+ Ue(w, k);
967
+ D.current = [], P([]);
968
968
  }
969
969
  return;
970
970
  }
971
971
  if (d && I[0].highlightData.pageLastModifiedAt !== d) {
972
- const { notesForUpdate: O, noteIdsForDelete: L } = Mt(
973
- R,
972
+ const { notesForUpdate: w, noteIdsForDelete: O } = Mt(
973
+ k,
974
974
  I,
975
975
  d
976
976
  );
977
- for (const H of O)
977
+ for (const H of w)
978
978
  N({ id: H.id, input: H }).catch((le) => r == null ? void 0 : r(le));
979
- for (const H of L)
980
- v(H, { onError: s });
979
+ for (const H of O)
980
+ C(H, { onError: s });
981
981
  } else {
982
- for (const O of I) {
983
- const L = se(O);
984
- M.add(O.id), L && (u.push(O), E.push(L));
982
+ for (const w of I) {
983
+ const O = se(w);
984
+ B.add(w.id), O && (u.push(w), b.push(O));
985
985
  }
986
- for (const O of P.current)
987
- M.has(O.id) || Ue(O, R);
988
- b(E), P.current = u, g && Bt(g);
986
+ for (const w of D.current)
987
+ B.has(w.id) || Ue(w, k);
988
+ P(b), D.current = u, h && Bt(h);
989
989
  }
990
990
  }, [
991
991
  Z,
992
- W,
992
+ Q,
993
993
  se,
994
994
  d,
995
995
  t,
996
996
  N,
997
- v,
998
- g
997
+ C,
998
+ h
999
999
  ]);
1000
- const $ = (R) => {
1000
+ const $ = (k) => {
1001
1001
  const I = t.current;
1002
- if (!D || !I) return;
1003
- const M = ie.fromRange(I, D), u = oe.fromRange(I, D);
1004
- B(
1002
+ if (!T || !I) return;
1003
+ const B = ie.fromRange(I, T), u = oe.fromRange(I, T);
1004
+ G(
1005
1005
  {
1006
1006
  courseId: p,
1007
1007
  objectId: m,
1008
1008
  objectType: c,
1009
1009
  userText: "",
1010
- reaction: [R],
1010
+ reaction: [k],
1011
1011
  highlightData: {
1012
- selectedText: w,
1012
+ selectedText: v,
1013
1013
  textPosition: (u == null ? void 0 : u.toSelector()) ?? null,
1014
- range: M.toSelector(),
1014
+ range: B.toSelector(),
1015
1015
  pageLastModifiedAt: d ?? ""
1016
1016
  }
1017
1017
  },
1018
1018
  {
1019
- onSuccess: (E) => {
1020
- var L;
1021
- const O = E.id;
1022
- G(), (L = window.getSelection()) == null || L.removeAllRanges(), y(O), T(), l == null || l(E);
1019
+ onSuccess: (b) => {
1020
+ var O;
1021
+ const w = b.id;
1022
+ U(), (O = window.getSelection()) == null || O.removeAllRanges(), y(w), S(), l == null || l(b);
1023
1023
  },
1024
1024
  onError: o
1025
1025
  }
1026
1026
  );
1027
1027
  };
1028
- return !D || !q ? null : ut(
1028
+ return !T || !z ? null : ut(
1029
1029
  /* @__PURE__ */ i(
1030
1030
  "div",
1031
1031
  {
@@ -1034,13 +1034,13 @@ function To({
1034
1034
  style: {
1035
1035
  position: "fixed",
1036
1036
  zIndex: 100,
1037
- top: q.top,
1038
- left: q.left,
1037
+ top: z.top,
1038
+ left: z.left,
1039
1039
  whiteSpace: "nowrap"
1040
1040
  },
1041
- onBlur: (R) => {
1041
+ onBlur: (k) => {
1042
1042
  const I = document.getElementById(Se);
1043
- I != null && I.contains(R.relatedTarget) || G();
1043
+ I != null && I.contains(k.relatedTarget) || U();
1044
1044
  },
1045
1045
  children: /* @__PURE__ */ i(jn, { onSelectReaction: $ })
1046
1046
  }
@@ -1049,12 +1049,12 @@ function To({
1049
1049
  );
1050
1050
  }
1051
1051
  const Wn = (t, e) => ({
1052
- backgroundColor: t === A.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
1053
- underlineColor: t === A.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
1054
- underlineStyle: t === A.IMPORTANT ? "solid" : "dashed"
1052
+ backgroundColor: t === L.IMPORTANT ? e.colors.importantBackground : e.colors.confusingBackground,
1053
+ underlineColor: t === L.IMPORTANT ? e.colors.importantUnderline : e.colors.confusingUnderline,
1054
+ underlineStyle: t === L.IMPORTANT ? "solid" : "dashed"
1055
1055
  }), Ce = ({
1056
1056
  children: t,
1057
- type: e = A.IMPORTANT,
1057
+ type: e = L.IMPORTANT,
1058
1058
  isCardActive: n = !0,
1059
1059
  theme: o
1060
1060
  }) => {
@@ -1071,9 +1071,9 @@ const Wn = (t, e) => ({
1071
1071
  return /* @__PURE__ */ i("span", { "data-note-highlight": "true", style: l, children: t });
1072
1072
  }, at = () => {
1073
1073
  const { translations: t } = V();
1074
- return /* @__PURE__ */ C(x, { gap: "xx-small", alignItems: "start", as: "div", children: [
1075
- /* @__PURE__ */ i(x.Item, { as: "div", children: /* @__PURE__ */ i(pt, { color: "error" }) }),
1076
- /* @__PURE__ */ i(x.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(Ie, { maxLines: 3, children: t.highlightUnavailable }) })
1074
+ return /* @__PURE__ */ x(R, { gap: "xx-small", alignItems: "start", as: "div", children: [
1075
+ /* @__PURE__ */ i(R.Item, { as: "div", children: /* @__PURE__ */ i(pt, { color: "error" }) }),
1076
+ /* @__PURE__ */ i(R.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ i(Ie, { maxLines: 3, children: t.highlightUnavailable }) })
1077
1077
  ] });
1078
1078
  }, zn = {
1079
1079
  filter: null,
@@ -1119,80 +1119,80 @@ function vo({
1119
1119
  }) {
1120
1120
  var se;
1121
1121
  const [l, a] = Ke(qn, zn), { filter: m, courseFilter: c, currentPage: p, totalPages: d } = l;
1122
- j(() => {
1122
+ W(() => {
1123
1123
  a({ type: "SET_PAGE", payload: 1 });
1124
1124
  }, [r]);
1125
- const g = n ? c : e, S = (p - 1) * r, y = !!o, T = {
1126
- ...g ? { courseId: g } : {},
1125
+ const h = n ? c : e, E = (p - 1) * r, y = !!o, S = {
1126
+ ...h ? { courseId: h } : {},
1127
1127
  ...m ? { reactions: [m] } : {},
1128
1128
  ...o ? { learningObject: o } : {}
1129
1129
  }, {
1130
- data: h,
1131
- isLoading: W,
1132
- isError: B
1130
+ data: g,
1131
+ isLoading: Q,
1132
+ isError: G
1133
1133
  } = tt({
1134
1134
  api: t,
1135
- filter: T,
1136
- offset: S,
1135
+ filter: S,
1136
+ offset: E,
1137
1137
  pageSize: r,
1138
1138
  enabled: !y
1139
1139
  }), {
1140
1140
  data: N,
1141
- isLoading: v,
1142
- isError: P
1141
+ isLoading: C,
1142
+ isError: D
1143
1143
  } = nt({
1144
1144
  api: t,
1145
- courseId: g ?? void 0,
1145
+ courseId: h ?? void 0,
1146
1146
  learningObject: o,
1147
1147
  enabled: y
1148
- }), F = me(() => {
1148
+ }), M = me(() => {
1149
1149
  const $ = (N == null ? void 0 : N.notes) ?? [];
1150
- return m ? $.filter((R) => R.reaction.includes(m)) : $;
1151
- }, [N, m]), b = _(null);
1152
- j(() => {
1150
+ return m ? $.filter((k) => k.reaction.includes(m)) : $;
1151
+ }, [N, m]), P = F(null);
1152
+ W(() => {
1153
1153
  if (!s) {
1154
- b.current = null;
1154
+ P.current = null;
1155
1155
  return;
1156
1156
  }
1157
- if (b.current === s) return;
1158
- const $ = F.findIndex((I) => I.id === s);
1157
+ if (P.current === s) return;
1158
+ const $ = M.findIndex((I) => I.id === s);
1159
1159
  if ($ === -1) return;
1160
- b.current = s;
1161
- const R = Math.floor($ / r) + 1;
1162
- R !== p && a({ type: "FOCUS_PAGE", payload: R });
1163
- }, [s, F, r, p]);
1164
- const D = y ? F.slice(S, S + r) : (h == null ? void 0 : h.notes) ?? [], k = y ? v : W, w = y ? P : B, z = y ? Math.max(1, Math.ceil(F.length / r)) : ((se = h == null ? void 0 : h.pageInfo) == null ? void 0 : se.totalNrOfPages) ?? void 0, q = y ? { totalCount: F.length, totalNrOfPages: z } : h == null ? void 0 : h.pageInfo;
1165
- j(() => {
1166
- a({ type: "SET_TOTAL_PAGES", payload: z });
1167
- }, [z]);
1168
- const Y = K(($) => {
1160
+ P.current = s;
1161
+ const k = Math.floor($ / r) + 1;
1162
+ k !== p && a({ type: "FOCUS_PAGE", payload: k });
1163
+ }, [s, M, r, p]);
1164
+ const T = y ? M.slice(E, E + r) : (g == null ? void 0 : g.notes) ?? [], A = y ? C : Q, v = y ? D : G, _ = y ? Math.max(1, Math.ceil(M.length / r)) : ((se = g == null ? void 0 : g.pageInfo) == null ? void 0 : se.totalNrOfPages) ?? void 0, z = y ? { totalCount: M.length, totalNrOfPages: _ } : g == null ? void 0 : g.pageInfo;
1165
+ W(() => {
1166
+ a({ type: "SET_TOTAL_PAGES", payload: _ });
1167
+ }, [_]);
1168
+ const Y = q(($) => {
1169
1169
  a({ type: "SET_PAGE", payload: $ });
1170
- }, []), re = K(() => {
1170
+ }, []), re = q(() => {
1171
1171
  a({
1172
1172
  type: "INCREMENT_PAGE"
1173
1173
  /* IncrementPage */
1174
1174
  });
1175
- }, []), Z = K(() => {
1175
+ }, []), Z = q(() => {
1176
1176
  a({
1177
1177
  type: "DECREMENT_PAGE"
1178
1178
  /* DecrementPage */
1179
1179
  });
1180
- }, []), J = K(($) => {
1180
+ }, []), J = q(($) => {
1181
1181
  a({ type: "SET_FILTER", payload: $ });
1182
- }, []), G = K(($) => {
1182
+ }, []), U = q(($) => {
1183
1183
  a({ type: "SET_COURSE_FILTER", payload: $ });
1184
1184
  }, []);
1185
1185
  return {
1186
- notes: D,
1187
- pageInfo: q,
1188
- isLoading: k,
1189
- isError: w,
1186
+ notes: T,
1187
+ pageInfo: z,
1188
+ isLoading: A,
1189
+ isError: v,
1190
1190
  filter: m,
1191
1191
  courseFilter: c,
1192
1192
  currentPage: p,
1193
1193
  totalPages: d,
1194
1194
  setFilter: J,
1195
- setCourseFilter: G,
1195
+ setCourseFilter: U,
1196
1196
  setPage: Y,
1197
1197
  fetchNextPage: re,
1198
1198
  fetchPreviousPage: Z
@@ -1203,11 +1203,11 @@ function Io({ filter: t, setFilter: e }) {
1203
1203
  const { translations: n } = V(), o = me(
1204
1204
  () => [
1205
1205
  { label: n.allNotes, value: Te },
1206
- { label: n.important, value: A.IMPORTANT },
1207
- { label: n.unclear, value: A.CONFUSING }
1206
+ { label: n.important, value: L.IMPORTANT },
1207
+ { label: n.unclear, value: L.CONFUSING }
1208
1208
  ],
1209
1209
  [n]
1210
- ), r = K(
1210
+ ), r = q(
1211
1211
  (l, { value: a }) => {
1212
1212
  e(!a || a === Te ? null : a);
1213
1213
  },
@@ -1232,46 +1232,46 @@ function Io({ filter: t, setFilter: e }) {
1232
1232
  }
1233
1233
  const Kn = ({ hasActiveFilter: t = !1 }) => {
1234
1234
  const { translations: e } = V(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
1235
- return /* @__PURE__ */ i(Q, { as: "div", textAlign: "center", children: /* @__PURE__ */ C(x, { direction: "column", alignItems: "center", gap: "small", children: [
1235
+ return /* @__PURE__ */ i(X, { as: "div", textAlign: "center", children: /* @__PURE__ */ x(R, { direction: "column", alignItems: "center", gap: "small", children: [
1236
1236
  !t && /* @__PURE__ */ i(yt, { size: "medium" }),
1237
1237
  /* @__PURE__ */ i(Ne, { level: "h3", children: n }),
1238
1238
  /* @__PURE__ */ i(ee, { color: "secondary", children: o })
1239
1239
  ] }) });
1240
1240
  }, Xn = {
1241
- [A.IMPORTANT]: {
1241
+ [L.IMPORTANT]: {
1242
1242
  color: "success",
1243
1243
  translationKey: "important",
1244
1244
  icon: /* @__PURE__ */ i(we, { size: "x-small" })
1245
1245
  },
1246
- [A.CONFUSING]: {
1246
+ [L.CONFUSING]: {
1247
1247
  color: "danger",
1248
1248
  translationKey: "unclear",
1249
1249
  icon: /* @__PURE__ */ i(ke, { size: "x-small" })
1250
1250
  }
1251
1251
  }, ct = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
1252
- const { translations: o } = V(), r = Xn[t], s = o[r.translationKey], [l, a] = U(!1), m = _(null), c = _(null), p = _(null), d = K(
1253
- (g) => {
1254
- e == null || e(g), a(!1);
1252
+ const { translations: o } = V(), r = Xn[t], s = o[r.translationKey], [l, a] = j(!1), m = F(null), c = F(null), p = F(null), d = q(
1253
+ (h) => {
1254
+ e == null || e(h), a(!1);
1255
1255
  },
1256
1256
  [e]
1257
1257
  );
1258
- return j(() => {
1258
+ return W(() => {
1259
1259
  if (!l) return;
1260
- const g = (y) => {
1260
+ const h = (y) => {
1261
1261
  y.key === "Escape" && y.stopPropagation();
1262
- }, S = (y) => {
1263
- var T;
1264
- y.key === "Escape" && (y.stopPropagation(), a(!1), (T = p.current) == null || T.focus());
1262
+ }, E = (y) => {
1263
+ var S;
1264
+ y.key === "Escape" && (y.stopPropagation(), a(!1), (S = p.current) == null || S.focus());
1265
1265
  };
1266
- return document.addEventListener("keydown", g, !0), document.addEventListener("keyup", S, !0), () => {
1267
- document.removeEventListener("keydown", g, !0), document.removeEventListener("keyup", S, !0);
1266
+ return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", E, !0), () => {
1267
+ document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", E, !0);
1268
1268
  };
1269
- }, [l]), n && e ? /* @__PURE__ */ C(
1269
+ }, [l]), n && e ? /* @__PURE__ */ x(
1270
1270
  ce,
1271
1271
  {
1272
1272
  placement: "bottom start",
1273
1273
  show: l,
1274
- onToggle: (g) => a(g),
1274
+ onToggle: (h) => a(h),
1275
1275
  shouldHideOnSelect: !0,
1276
1276
  shouldFocusTriggerOnClose: !0,
1277
1277
  trigger: /* @__PURE__ */ i(
@@ -1279,24 +1279,24 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
1279
1279
  {
1280
1280
  color: r.color,
1281
1281
  renderIcon: r.icon,
1282
- elementRef: (g) => {
1283
- p.current = g;
1282
+ elementRef: (h) => {
1283
+ p.current = h;
1284
1284
  },
1285
1285
  children: s
1286
1286
  }
1287
1287
  ),
1288
1288
  children: [
1289
- /* @__PURE__ */ C(ce.Item, { ref: m, onClick: () => d(A.CONFUSING), children: [
1289
+ /* @__PURE__ */ x(ce.Item, { ref: m, onClick: () => d(L.CONFUSING), children: [
1290
1290
  /* @__PURE__ */ i(ke, { size: "x-small" }),
1291
1291
  ` ${o.markUnclear}`
1292
1292
  ] }),
1293
- /* @__PURE__ */ C(ce.Item, { ref: c, onClick: () => d(A.IMPORTANT), children: [
1293
+ /* @__PURE__ */ x(ce.Item, { ref: c, onClick: () => d(L.IMPORTANT), children: [
1294
1294
  /* @__PURE__ */ i(we, { size: "x-small" }),
1295
1295
  ` ${o.markImportant}`
1296
1296
  ] })
1297
1297
  ]
1298
1298
  }
1299
- ) : /* @__PURE__ */ i(Q, { display: "inline-flex", children: /* @__PURE__ */ i(Be, { color: r.color, renderIcon: r.icon, children: s }) });
1299
+ ) : /* @__PURE__ */ i(X, { display: "inline-flex", children: /* @__PURE__ */ i(Be, { color: r.color, renderIcon: r.icon, children: s }) });
1300
1300
  }, je = "0.75rem";
1301
1301
  function We(t, e) {
1302
1302
  return (t instanceof Date ? t : new Date(t)).toLocaleString(e, {
@@ -1318,47 +1318,47 @@ const Qn = ({
1318
1318
  isActive: c,
1319
1319
  isPanelView: p = !1,
1320
1320
  courseName: d,
1321
- locale: g,
1322
- highlightTheme: S,
1321
+ locale: h,
1322
+ highlightTheme: E,
1323
1323
  renderLink: y,
1324
- href: T
1324
+ href: S
1325
1325
  }) => {
1326
- const { translations: h } = V(), [W, B] = U(!1), [N, v] = U(!1), [P, F] = U(o || ""), [b, D] = U(!1), k = _(null), w = K((u) => {
1327
- k.current = u;
1328
- }, []), z = _(null), q = _(null), Y = _(!1), re = _(null), Z = _(null), J = _(!1);
1329
- j(() => {
1330
- var u, E;
1331
- c ? ((u = k.current) == null || u.scrollIntoView({ behavior: "smooth", block: "nearest" }), (E = k.current) == null || E.focus()) : D(!1);
1332
- }, [c]), j(() => {
1333
- var u, E;
1334
- N ? (Y.current = !0, (u = z.current) == null || u.focus()) : Y.current && (Y.current = !1, (E = q.current) == null || E.focus());
1335
- }, [N]), j(() => {
1336
- if (!b && J.current) {
1326
+ const { translations: g } = V(), [Q, G] = j(!1), [N, C] = j(!1), [D, M] = j(o || ""), [P, T] = j(!1), A = F(null), v = q((u) => {
1327
+ A.current = u;
1328
+ }, []), _ = F(null), z = F(null), Y = F(!1), re = F(null), Z = F(null), J = F(!1);
1329
+ W(() => {
1330
+ var u, b;
1331
+ c ? ((u = A.current) == null || u.scrollIntoView({ behavior: "smooth", block: "nearest" }), (b = A.current) == null || b.focus()) : T(!1);
1332
+ }, [c]), W(() => {
1333
+ var u, b;
1334
+ N ? (Y.current = !0, (u = _.current) == null || u.focus()) : Y.current && (Y.current = !1, (b = z.current) == null || b.focus());
1335
+ }, [N]), W(() => {
1336
+ if (!P && J.current) {
1337
1337
  J.current = !1;
1338
1338
  const u = re.current;
1339
1339
  u != null && u.isConnected && u.focus();
1340
1340
  }
1341
- }, [b]);
1342
- const G = K((u, E) => {
1343
- J.current = !E, D(!1);
1341
+ }, [P]);
1342
+ const U = q((u, b) => {
1343
+ J.current = !b, T(!1);
1344
1344
  }, []);
1345
- j(() => {
1346
- if (!b) return;
1347
- const u = (O) => {
1348
- O.key === "Escape" && O.stopPropagation();
1349
- }, E = (O) => {
1350
- O.key === "Escape" && (O.stopPropagation(), G());
1345
+ W(() => {
1346
+ if (!P) return;
1347
+ const u = (w) => {
1348
+ w.key === "Escape" && w.stopPropagation();
1349
+ }, b = (w) => {
1350
+ w.key === "Escape" && (w.stopPropagation(), U());
1351
1351
  };
1352
- return window.addEventListener("keydown", u, !0), window.addEventListener("keyup", E, !0), () => {
1353
- window.removeEventListener("keydown", u, !0), window.removeEventListener("keyup", E, !0);
1352
+ return window.addEventListener("keydown", u, !0), window.addEventListener("keyup", b, !0), () => {
1353
+ window.removeEventListener("keydown", u, !0), window.removeEventListener("keyup", b, !0);
1354
1354
  };
1355
- }, [b, G]);
1356
- const se = r === A.IMPORTANT ? h.important : h.unclear, $ = (u) => {
1355
+ }, [P, U]);
1356
+ const se = r === L.IMPORTANT ? g.important : g.unclear, $ = (u) => {
1357
1357
  u.key === "Enter" && (u.preventDefault(), s == null || s());
1358
- }, R = [se, h.note];
1359
- n && R.push(n), o && R.push(o), e && R.push(We(e, g)), d && R.push(d);
1360
- const I = R.join(", "), M = /* @__PURE__ */ C(
1361
- Q,
1358
+ }, k = [se, g.note];
1359
+ n && k.push(n), o && k.push(o), e && k.push(We(e, h)), d && k.push(d);
1360
+ const I = k.join(", "), B = /* @__PURE__ */ x(
1361
+ X,
1362
1362
  {
1363
1363
  as: "div",
1364
1364
  height: "100%",
@@ -1366,15 +1366,15 @@ const Qn = ({
1366
1366
  borderRadius: "medium",
1367
1367
  padding: "small",
1368
1368
  position: "relative",
1369
- role: T ? void 0 : c || N ? "group" : "button",
1370
- "aria-label": T ? void 0 : I,
1371
- "aria-pressed": T || c || N ? void 0 : c,
1372
- tabIndex: T || c ? -1 : 0,
1369
+ role: S ? void 0 : c || N ? "group" : "button",
1370
+ "aria-label": S ? void 0 : I,
1371
+ "aria-pressed": S || c || N ? void 0 : c,
1372
+ tabIndex: S || c ? -1 : 0,
1373
1373
  "data-testid": `note-card-${t}`,
1374
- elementRef: w,
1374
+ elementRef: v,
1375
1375
  onClick: c ? void 0 : s,
1376
- onMouseEnter: () => B(!0),
1377
- onMouseLeave: () => B(!1),
1376
+ onMouseEnter: () => G(!0),
1377
+ onMouseLeave: () => G(!1),
1378
1378
  onKeyDown: c ? void 0 : $,
1379
1379
  cursor: N ? "default" : "pointer",
1380
1380
  children: [
@@ -1384,9 +1384,9 @@ const Qn = ({
1384
1384
  "data-testid": `note-card-${t}-content`,
1385
1385
  style: {
1386
1386
  height: "100%",
1387
- opacity: c && b && l ? 0.25 : void 0
1387
+ opacity: c && P && l ? 0.25 : void 0
1388
1388
  },
1389
- children: /* @__PURE__ */ C(x, { direction: "column", gap: "small", height: "100%", children: [
1389
+ children: /* @__PURE__ */ x(R, { direction: "column", gap: "small", height: "100%", children: [
1390
1390
  /* @__PURE__ */ i(
1391
1391
  ct,
1392
1392
  {
@@ -1399,47 +1399,47 @@ const Qn = ({
1399
1399
  Ce,
1400
1400
  {
1401
1401
  type: r,
1402
- isCardActive: !!c || W,
1403
- theme: S,
1402
+ isCardActive: !!c || Q,
1403
+ theme: E,
1404
1404
  children: n
1405
1405
  }
1406
1406
  ) : /* @__PURE__ */ i(Ie, { maxLines: 3, truncate: "word", children: /* @__PURE__ */ i(
1407
1407
  Ce,
1408
1408
  {
1409
1409
  type: r,
1410
- isCardActive: !!c || W,
1411
- theme: S,
1410
+ isCardActive: !!c || Q,
1411
+ theme: E,
1412
1412
  children: n
1413
1413
  }
1414
1414
  ) }) }) }) : /* @__PURE__ */ i(at, {}),
1415
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ C(x, { direction: "column", gap: "small", height: "100%", children: [
1416
- N && p ? /* @__PURE__ */ C(x, { direction: "column", gap: "x-small", margin: "xx-small", children: [
1415
+ /* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ x(R, { direction: "column", gap: "small", height: "100%", children: [
1416
+ N && p ? /* @__PURE__ */ x(R, { direction: "column", gap: "x-small", margin: "xx-small", children: [
1417
1417
  /* @__PURE__ */ i(
1418
1418
  Xe,
1419
1419
  {
1420
- label: /* @__PURE__ */ i(bt, { children: h.editNote }),
1421
- value: P,
1422
- onChange: (u) => F(u.target.value),
1423
- placeholder: h.addNoteOptional,
1420
+ label: /* @__PURE__ */ i(bt, { children: g.editNote }),
1421
+ value: D,
1422
+ onChange: (u) => M(u.target.value),
1423
+ placeholder: g.addNoteOptional,
1424
1424
  textareaRef: (u) => {
1425
- z.current = u;
1425
+ _.current = u;
1426
1426
  }
1427
1427
  }
1428
1428
  ),
1429
- /* @__PURE__ */ C(x, { gap: "xx-small", children: [
1430
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1429
+ /* @__PURE__ */ x(R, { gap: "xx-small", children: [
1430
+ /* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1431
1431
  te,
1432
1432
  {
1433
1433
  display: "block",
1434
1434
  size: "small",
1435
1435
  "data-testid": `note-card-${t}-cancel`,
1436
1436
  onClick: () => {
1437
- F(o || ""), v(!1);
1437
+ M(o || ""), C(!1);
1438
1438
  },
1439
- children: h.cancel
1439
+ children: g.cancel
1440
1440
  }
1441
1441
  ) }),
1442
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1442
+ /* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1443
1443
  te,
1444
1444
  {
1445
1445
  display: "block",
@@ -1447,13 +1447,13 @@ const Qn = ({
1447
1447
  size: "small",
1448
1448
  "data-testid": `note-card-${t}-save`,
1449
1449
  onClick: () => {
1450
- a == null || a(t, P.trim()), v(!1);
1450
+ a == null || a(t, D.trim()), C(!1);
1451
1451
  },
1452
- children: h.save
1452
+ children: g.save
1453
1453
  }
1454
1454
  ) })
1455
1455
  ] })
1456
- ] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && p ? /* @__PURE__ */ C(ee, { children: [
1456
+ ] }) : o ? /* @__PURE__ */ i("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && p ? /* @__PURE__ */ x(ee, { children: [
1457
1457
  o,
1458
1458
  " ",
1459
1459
  /* @__PURE__ */ i(
@@ -1463,19 +1463,19 @@ const Qn = ({
1463
1463
  withBackground: !1,
1464
1464
  withBorder: !1,
1465
1465
  margin: "xx-small 0 0 xxx-small",
1466
- screenReaderLabel: h.editNote,
1466
+ screenReaderLabel: g.editNote,
1467
1467
  "data-testid": `note-card-${t}-edit`,
1468
1468
  elementRef: (u) => {
1469
- q.current = u;
1469
+ z.current = u;
1470
1470
  },
1471
1471
  onClick: (u) => {
1472
- u.stopPropagation(), v(!0);
1472
+ u.stopPropagation(), C(!0);
1473
1473
  },
1474
1474
  children: /* @__PURE__ */ i(ve, {})
1475
1475
  }
1476
1476
  )
1477
- ] }) : /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Ie, { maxLines: 3, truncate: "word", children: o }) }) }) : p && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ C(ee, { color: "secondary", children: [
1478
- h.addNotePrompt,
1477
+ ] }) : /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Ie, { maxLines: 3, truncate: "word", children: o }) }) }) : p && c ? /* @__PURE__ */ i("div", { children: /* @__PURE__ */ x(ee, { color: "secondary", children: [
1478
+ g.addNotePrompt,
1479
1479
  " ",
1480
1480
  /* @__PURE__ */ i(
1481
1481
  ue,
@@ -1484,20 +1484,20 @@ const Qn = ({
1484
1484
  withBackground: !1,
1485
1485
  withBorder: !1,
1486
1486
  margin: "xx-small 0 0 xxx-small",
1487
- screenReaderLabel: h.editNote,
1487
+ screenReaderLabel: g.editNote,
1488
1488
  "data-testid": `note-card-${t}-edit`,
1489
1489
  elementRef: (u) => {
1490
- q.current = u;
1490
+ z.current = u;
1491
1491
  },
1492
1492
  onClick: (u) => {
1493
- u.stopPropagation(), v(!0);
1493
+ u.stopPropagation(), C(!0);
1494
1494
  },
1495
1495
  children: /* @__PURE__ */ i(ve, {})
1496
1496
  }
1497
1497
  )
1498
1498
  ] }) }) : null,
1499
- /* @__PURE__ */ C(x, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
1500
- /* @__PURE__ */ i(ee, { size: "small", color: "secondary", children: We(e, g) }),
1499
+ /* @__PURE__ */ x(R, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
1500
+ /* @__PURE__ */ i(ee, { size: "small", color: "secondary", children: We(e, h) }),
1501
1501
  c && l && /* @__PURE__ */ i(
1502
1502
  ue,
1503
1503
  {
@@ -1506,38 +1506,38 @@ const Qn = ({
1506
1506
  withBorder: !1,
1507
1507
  color: "danger",
1508
1508
  margin: "xx-small",
1509
- screenReaderLabel: h.deleteNote,
1509
+ screenReaderLabel: g.deleteNote,
1510
1510
  "data-testid": `note-card-${t}-delete`,
1511
1511
  elementRef: (u) => {
1512
1512
  re.current = u;
1513
1513
  },
1514
1514
  onClick: (u) => {
1515
- u.stopPropagation(), J.current = !1, D(!0);
1515
+ u.stopPropagation(), J.current = !1, T(!0);
1516
1516
  },
1517
1517
  children: /* @__PURE__ */ i(ye, {})
1518
1518
  }
1519
1519
  )
1520
1520
  ] }),
1521
- d && /* @__PURE__ */ i(ee, { size: "small", color: "secondary", children: d })
1521
+ d && /* @__PURE__ */ i(ee, { size: "small", color: "secondary", "data-testid": `note-card-${t}-course`, children: d })
1522
1522
  ] }) })
1523
1523
  ] })
1524
1524
  }
1525
1525
  ),
1526
- c && b && l && /* @__PURE__ */ i(
1526
+ c && P && l && /* @__PURE__ */ i(
1527
1527
  Et,
1528
1528
  {
1529
1529
  open: !0,
1530
1530
  as: "div",
1531
- label: h.deleteNoteConfirmation,
1531
+ label: g.deleteNoteConfirmation,
1532
1532
  shouldContainFocus: !0,
1533
1533
  shouldFocusOnOpen: !0,
1534
1534
  defaultFocusElement: () => Z.current,
1535
1535
  shouldCloseOnDocumentClick: !0,
1536
1536
  shouldCloseOnEscape: !1,
1537
1537
  shouldReturnFocus: !1,
1538
- onDismiss: G,
1538
+ onDismiss: U,
1539
1539
  children: /* @__PURE__ */ i(
1540
- Q,
1540
+ X,
1541
1541
  {
1542
1542
  as: "div",
1543
1543
  padding: "medium",
@@ -1547,8 +1547,8 @@ const Qn = ({
1547
1547
  insetInlineStart: "0",
1548
1548
  insetInlineEnd: "0",
1549
1549
  stacking: "above",
1550
- children: /* @__PURE__ */ C(
1551
- x,
1550
+ children: /* @__PURE__ */ x(
1551
+ R,
1552
1552
  {
1553
1553
  direction: "column",
1554
1554
  justifyItems: "center",
@@ -1562,22 +1562,22 @@ const Qn = ({
1562
1562
  display: "block",
1563
1563
  color: "danger",
1564
1564
  withBackground: !1,
1565
- themeOverride: (u, E) => ({
1565
+ themeOverride: (u, b) => ({
1566
1566
  borderRadius: je,
1567
1567
  // Ghost states default to translucent fills; the faded card would show through.
1568
- dangerGhostBackground: E.colors.contrasts.white1010,
1569
- dangerGhostHoverBackground: E.colors.contrasts.red1212,
1570
- dangerGhostActiveBackground: E.colors.contrasts.red1212,
1568
+ dangerGhostBackground: b.colors.contrasts.white1010,
1569
+ dangerGhostHoverBackground: b.colors.contrasts.red1212,
1570
+ dangerGhostActiveBackground: b.colors.contrasts.red1212,
1571
1571
  // red45 on the hover tint is 3.74:1; red57 clears AA in every state.
1572
- dangerGhostColor: E.colors.contrasts.red5782,
1573
- dangerGhostBorderColor: E.colors.contrasts.red5782
1572
+ dangerGhostColor: b.colors.contrasts.red5782,
1573
+ dangerGhostBorderColor: b.colors.contrasts.red5782
1574
1574
  }),
1575
1575
  renderIcon: /* @__PURE__ */ i(ye, {}),
1576
1576
  "data-testid": `note-card-${t}-confirm-delete`,
1577
1577
  onClick: (u) => {
1578
- u.stopPropagation(), l(t), D(!1);
1578
+ u.stopPropagation(), l(t), T(!1);
1579
1579
  },
1580
- children: h.deleteNote
1580
+ children: g.deleteNote
1581
1581
  }
1582
1582
  ),
1583
1583
  /* @__PURE__ */ i(
@@ -1585,19 +1585,19 @@ const Qn = ({
1585
1585
  {
1586
1586
  display: "block",
1587
1587
  withBackground: !1,
1588
- themeOverride: (u, E) => ({
1588
+ themeOverride: (u, b) => ({
1589
1589
  borderRadius: je,
1590
- secondaryGhostBackground: E.colors.contrasts.white1010,
1591
- secondaryGhostActiveBackground: E.colors.contrasts.grey1111
1590
+ secondaryGhostBackground: b.colors.contrasts.white1010,
1591
+ secondaryGhostActiveBackground: b.colors.contrasts.grey1111
1592
1592
  }),
1593
1593
  "data-testid": `note-card-${t}-cancel-delete`,
1594
1594
  elementRef: (u) => {
1595
1595
  Z.current = u;
1596
1596
  },
1597
1597
  onClick: (u) => {
1598
- u.stopPropagation(), G();
1598
+ u.stopPropagation(), U();
1599
1599
  },
1600
- children: h.cancel
1600
+ children: g.cancel
1601
1601
  }
1602
1602
  )
1603
1603
  ]
@@ -1610,7 +1610,7 @@ const Qn = ({
1610
1610
  ]
1611
1611
  }
1612
1612
  );
1613
- return T && y ? y({ href: T, children: M, ariaLabel: I }) : M;
1613
+ return S && y ? y({ href: S, children: B, ariaLabel: I }) : B;
1614
1614
  }, Yn = {
1615
1615
  display: "grid",
1616
1616
  gap: "1rem",
@@ -1632,80 +1632,82 @@ const Qn = ({
1632
1632
  onNoteTypeChange: c,
1633
1633
  onNotesEmptied: p,
1634
1634
  selectedNoteId: d,
1635
- hasActiveFilter: g = !1,
1636
- columnCount: S = 1,
1635
+ hasActiveFilter: h = !1,
1636
+ columnCount: E = 1,
1637
1637
  highlightTheme: y,
1638
- locale: T,
1639
- renderNoteLink: h,
1640
- noteHref: W
1638
+ locale: S,
1639
+ courseNames: g,
1640
+ renderNoteLink: Q,
1641
+ noteHref: G
1641
1642
  }) => {
1642
- const { translations: B } = V(), N = _(null), v = _(null), P = K(
1643
- (b) => {
1644
- const D = t.findIndex((w) => w.id === b);
1645
- let k = null;
1646
- t.length > 1 && (k = D > 0 ? t[D - 1].id : t[1].id), v.current = { targetId: k }, a == null || a(b);
1643
+ const { translations: N } = V(), C = F(null), D = F(null), M = q(
1644
+ (T) => {
1645
+ const A = t.findIndex((_) => _.id === T);
1646
+ let v = null;
1647
+ t.length > 1 && (v = A > 0 ? t[A - 1].id : t[1].id), D.current = { targetId: v }, a == null || a(T);
1647
1648
  },
1648
1649
  [t, a]
1649
1650
  );
1650
- if (j(() => {
1651
- var D;
1652
- const b = v.current;
1653
- if (b)
1654
- if (v.current = null, b.targetId === null)
1651
+ if (W(() => {
1652
+ var A;
1653
+ const T = D.current;
1654
+ if (T)
1655
+ if (D.current = null, T.targetId === null)
1655
1656
  p == null || p();
1656
1657
  else {
1657
- const k = (D = N.current) == null ? void 0 : D.querySelector(
1658
- `[data-testid="note-card-${b.targetId}"]`
1658
+ const v = (A = C.current) == null ? void 0 : A.querySelector(
1659
+ `[data-testid="note-card-${T.targetId}"]`
1659
1660
  );
1660
- k == null || k.focus();
1661
+ v == null || v.focus();
1661
1662
  }
1662
1663
  }, [t, p]), e)
1663
- return /* @__PURE__ */ i(Q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(Tt, { renderTitle: B.loadingNotes }) });
1664
+ return /* @__PURE__ */ i(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ i(Tt, { renderTitle: N.loadingNotes }) });
1664
1665
  if (n)
1665
- return /* @__PURE__ */ i(Q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(Ne, { level: "h4", children: B.failedToLoadNotes }) });
1666
+ return /* @__PURE__ */ i(X, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ i(Ne, { level: "h4", children: N.failedToLoadNotes }) });
1666
1667
  if (t.length === 0)
1667
- return /* @__PURE__ */ i(Q, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(Kn, { hasActiveFilter: g }) });
1668
- const F = typeof o == "number" && typeof r == "number" && r > 1 && s !== void 0;
1669
- return /* @__PURE__ */ C(dt, { children: [
1668
+ return /* @__PURE__ */ i(X, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ i(Kn, { hasActiveFilter: h }) });
1669
+ const P = typeof o == "number" && typeof r == "number" && r > 1 && s !== void 0;
1670
+ return /* @__PURE__ */ x(dt, { children: [
1670
1671
  /* @__PURE__ */ i(
1671
1672
  "ul",
1672
1673
  {
1673
- ref: N,
1674
- style: { ...Yn, gridTemplateColumns: `repeat(${S}, minmax(0, 1fr))` },
1674
+ ref: C,
1675
+ style: { ...Yn, gridTemplateColumns: `repeat(${E}, minmax(0, 1fr))` },
1675
1676
  role: "list",
1676
1677
  "data-testid": "notes-grid",
1677
- children: t.map((b) => {
1678
- var D;
1678
+ children: t.map((T) => {
1679
+ var A;
1679
1680
  return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
1680
1681
  Qn,
1681
1682
  {
1682
- noteId: b.id,
1683
- date: b.createdAt,
1684
- type: b.reaction[0] ?? A.IMPORTANT,
1685
- highlight: (D = b.highlightData) == null ? void 0 : D.selectedText,
1686
- note: b.userText,
1687
- isActive: d === b.id,
1683
+ noteId: T.id,
1684
+ date: T.createdAt,
1685
+ type: T.reaction[0] ?? L.IMPORTANT,
1686
+ highlight: (A = T.highlightData) == null ? void 0 : A.selectedText,
1687
+ note: T.userText,
1688
+ isActive: d === T.id,
1688
1689
  isPanelView: !!d,
1689
- onClick: l ? () => l(b.id) : void 0,
1690
- onDelete: a ? P : void 0,
1691
- onSaveNote: m ? (k, w) => m(k, w) : void 0,
1692
- onTypeChange: c ? (k, w) => c(k, w) : void 0,
1690
+ onClick: l ? () => l(T.id) : void 0,
1691
+ onDelete: a ? M : void 0,
1692
+ onSaveNote: m ? (v, _) => m(v, _) : void 0,
1693
+ onTypeChange: c ? (v, _) => c(v, _) : void 0,
1693
1694
  highlightTheme: y,
1694
- locale: T,
1695
- renderLink: h,
1696
- href: W ? W(b.id, b) : void 0
1695
+ locale: S,
1696
+ courseName: g == null ? void 0 : g.get(T.courseId),
1697
+ renderLink: Q,
1698
+ href: G ? G(T.id, T) : void 0
1697
1699
  }
1698
- ) }, b.id);
1700
+ ) }, T.id);
1699
1701
  })
1700
1702
  }
1701
1703
  ),
1702
- F && /* @__PURE__ */ i(x, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ i(x.Item, { children: /* @__PURE__ */ i(
1704
+ P && /* @__PURE__ */ i(R, { justifyItems: "center", padding: "small", "data-testid": "notes-pagination", children: /* @__PURE__ */ i(R.Item, { children: /* @__PURE__ */ i(
1703
1705
  St,
1704
1706
  {
1705
1707
  as: "nav",
1706
1708
  variant: "input",
1707
- labelNext: B.nextPage,
1708
- labelPrev: B.previousPage,
1709
+ labelNext: N.nextPage,
1710
+ labelPrev: N.previousPage,
1709
1711
  currentPage: o,
1710
1712
  totalPageNumber: r,
1711
1713
  onPageChange: s
@@ -1723,34 +1725,34 @@ const Qn = ({
1723
1725
  onBack: a,
1724
1726
  editing: m = !1
1725
1727
  }) => {
1726
- const { translations: c } = V(), [p, d] = U(m), [g, S] = U(t || ""), [y, T] = U(!1);
1727
- return /* @__PURE__ */ C(x, { direction: "column", gap: "small", "data-testid": "single-note", children: [
1728
- n != null ? /* @__PURE__ */ i(Q, { as: "div", children: /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Ce, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ i(at, {}),
1728
+ const { translations: c } = V(), [p, d] = j(m), [h, E] = j(t || ""), [y, S] = j(!1);
1729
+ return /* @__PURE__ */ x(R, { direction: "column", gap: "small", "data-testid": "single-note", children: [
1730
+ n != null ? /* @__PURE__ */ i(X, { as: "div", children: /* @__PURE__ */ i(ee, { children: /* @__PURE__ */ i(Ce, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ i(at, {}),
1729
1731
  /* @__PURE__ */ i(ct, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
1730
- p ? /* @__PURE__ */ C(x, { direction: "column", gap: "x-small", children: [
1732
+ p ? /* @__PURE__ */ x(R, { direction: "column", gap: "x-small", children: [
1731
1733
  /* @__PURE__ */ i(
1732
1734
  Xe,
1733
1735
  {
1734
1736
  label: c.addNoteOptional,
1735
- value: g,
1736
- onChange: (h) => S(h.target.value),
1737
+ value: h,
1738
+ onChange: (g) => E(g.target.value),
1737
1739
  resize: "vertical"
1738
1740
  }
1739
1741
  ),
1740
- /* @__PURE__ */ C(x, { gap: "xx-small", children: [
1741
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1742
+ /* @__PURE__ */ x(R, { gap: "xx-small", children: [
1743
+ /* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1742
1744
  te,
1743
1745
  {
1744
1746
  display: "block",
1745
1747
  size: "small",
1746
1748
  "data-testid": "single-note-cancel",
1747
1749
  onClick: () => {
1748
- S(t || ""), d(!1);
1750
+ E(t || ""), d(!1);
1749
1751
  },
1750
1752
  children: c.cancel
1751
1753
  }
1752
1754
  ) }),
1753
- /* @__PURE__ */ i(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1755
+ /* @__PURE__ */ i(R.Item, { shouldGrow: !0, children: /* @__PURE__ */ i(
1754
1756
  te,
1755
1757
  {
1756
1758
  display: "block",
@@ -1758,18 +1760,18 @@ const Qn = ({
1758
1760
  size: "small",
1759
1761
  "data-testid": "single-note-save",
1760
1762
  onClick: () => {
1761
- r(g), d(!1);
1763
+ r(h), d(!1);
1762
1764
  },
1763
1765
  children: c.save
1764
1766
  }
1765
1767
  ) })
1766
1768
  ] })
1767
- ] }) : /* @__PURE__ */ C(x, { direction: "column", gap: "small", children: [
1768
- t && /* @__PURE__ */ C(Q, { as: "div", children: [
1769
+ ] }) : /* @__PURE__ */ x(R, { direction: "column", gap: "small", children: [
1770
+ t && /* @__PURE__ */ x(X, { as: "div", children: [
1769
1771
  /* @__PURE__ */ i(Ne, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
1770
1772
  /* @__PURE__ */ i(ee, { children: t })
1771
1773
  ] }),
1772
- /* @__PURE__ */ C(x, { justifyItems: "space-between", children: [
1774
+ /* @__PURE__ */ x(R, { justifyItems: "space-between", children: [
1773
1775
  /* @__PURE__ */ i(
1774
1776
  te,
1775
1777
  {
@@ -1780,7 +1782,7 @@ const Qn = ({
1780
1782
  children: c.back
1781
1783
  }
1782
1784
  ),
1783
- /* @__PURE__ */ C(x, { gap: "xx-small", children: [
1785
+ /* @__PURE__ */ x(R, { gap: "xx-small", children: [
1784
1786
  s && /* @__PURE__ */ i(
1785
1787
  ue,
1786
1788
  {
@@ -1790,7 +1792,7 @@ const Qn = ({
1790
1792
  color: "danger",
1791
1793
  screenReaderLabel: c.deleteNote,
1792
1794
  "data-testid": "single-note-delete",
1793
- onClick: () => T(!0),
1795
+ onClick: () => S(!0),
1794
1796
  children: /* @__PURE__ */ i(ye, {})
1795
1797
  }
1796
1798
  ),
@@ -1808,7 +1810,7 @@ const Qn = ({
1808
1810
  )
1809
1811
  ] })
1810
1812
  ] }),
1811
- y && s && /* @__PURE__ */ i(Q, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ C(x, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
1813
+ y && s && /* @__PURE__ */ i(X, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ x(R, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
1812
1814
  /* @__PURE__ */ i(
1813
1815
  te,
1814
1816
  {
@@ -1818,7 +1820,7 @@ const Qn = ({
1818
1820
  renderIcon: /* @__PURE__ */ i(ye, {}),
1819
1821
  "data-testid": "single-note-confirm-delete",
1820
1822
  onClick: () => {
1821
- s(), T(!1);
1823
+ s(), S(!1);
1822
1824
  },
1823
1825
  children: c.deleteNote
1824
1826
  }
@@ -1829,7 +1831,7 @@ const Qn = ({
1829
1831
  display: "block",
1830
1832
  size: "small",
1831
1833
  "data-testid": "single-note-cancel-delete",
1832
- onClick: () => T(!1),
1834
+ onClick: () => S(!1),
1833
1835
  children: c.cancel
1834
1836
  }
1835
1837
  )
@@ -1849,7 +1851,7 @@ export {
1849
1851
  Hn as NotebookTranslationsProvider,
1850
1852
  So as NotebookTray,
1851
1853
  Co as NotesListView,
1852
- A as REACTION_TYPE,
1854
+ L as REACTION_TYPE,
1853
1855
  xo as SingleNote,
1854
1856
  De as createTransparentColor,
1855
1857
  Vt as useCreateNote,