@campus-admin/core 2.0.8 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,703 @@
1
+ import { r as e, s as t, t as n } from "./ca-BP878D3q.js";
2
+ import { c as r, i, s as a, t as o } from "./session-Cvdtq46r.js";
3
+ import { a as s, i as c, n as l, o as ee, r as u, s as te, t as ne } from "./position-zvf9vBh1.js";
4
+ import { Fragment as d, Teleport as re, Transition as ie, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, createVNode as v, defineComponent as y, isRef as ae, nextTick as oe, normalizeClass as b, normalizeStyle as se, onMounted as ce, onUnmounted as le, openBlock as x, reactive as S, ref as C, renderList as w, resolveComponent as ue, toDisplayString as T, unref as E, watch as de, withCtx as D, withDirectives as fe, withKeys as pe } from "vue";
5
+ import { CaDropdown as me, CaDropdownItem as he, CaDropdownMenu as ge, CaIcon as _e } from "@campus-admin/ui";
6
+ import { useRoute as ve } from "vue-router";
7
+ // packages/core/src/layout/personal-tools/done-lines.ts
8
+ var O = "✓ ";
9
+ function k(e) {
10
+ return e.startsWith(O);
11
+ }
12
+ function ye(e) {
13
+ return e.split("\n").map((e) => ({
14
+ text: e,
15
+ done: k(e)
16
+ }));
17
+ }
18
+ function be(e) {
19
+ return e.split("\n").some(k);
20
+ }
21
+ function xe(e, t, n) {
22
+ let r = e.split("\n"), i = [], a = 0;
23
+ for (let e of r) i.push(a), a += e.length + 1;
24
+ let o = (e) => {
25
+ let t = 0;
26
+ for (; t + 1 < r.length && i[t + 1] <= e;) t++;
27
+ return t;
28
+ }, s = o(t), c = o(n);
29
+ n > t && c > s && n === i[c] && c--;
30
+ let l = r.slice(s, c + 1).map((e, t) => ({
31
+ index: s + t,
32
+ line: e
33
+ })).filter((e) => e.line.trim());
34
+ if (!l.length) return {
35
+ text: e,
36
+ start: t,
37
+ end: n
38
+ };
39
+ let ee = l.some((e) => !k(e.line)), u = /* @__PURE__ */ new Map();
40
+ for (let { index: e, line: t } of l) ee && !k(t) ? (r[e] = O + t, u.set(e, 2)) : ee || (r[e] = t.slice(2), u.set(e, -2));
41
+ let te = (e) => {
42
+ let t = o(e), n = 0;
43
+ for (let [e, r] of u) e < t && (n += r);
44
+ let r = u.get(t) ?? 0, a = e - i[t], s = r < 0 ? Math.max(0, a + r) : a + r;
45
+ return i[t] + n + s;
46
+ };
47
+ return {
48
+ text: r.join("\n"),
49
+ start: te(t),
50
+ end: te(n)
51
+ };
52
+ }
53
+ // packages/core/src/layout/personal-tools/PersonalNotes.vue?vue&type=script&setup=true&lang.ts
54
+ var Se = {
55
+ key: 0,
56
+ class: "notes-layer"
57
+ }, Ce = ["aria-label"], we = ["data-note-id", "onPointerdown"], Te = [
58
+ "aria-label",
59
+ "title",
60
+ "onPointerdown",
61
+ "onClick"
62
+ ], Ee = { class: "paper-corner__title" }, De = {
63
+ key: 1,
64
+ class: "paper-toolbar"
65
+ }, Oe = ["title", "onPointerdown"], ke = {
66
+ viewBox: "0 0 16 16",
67
+ width: "14",
68
+ height: "14",
69
+ fill: "currentColor",
70
+ "aria-hidden": "true"
71
+ }, Ae = ["cx"], je = [
72
+ "aria-label",
73
+ "placeholder",
74
+ "title",
75
+ "value",
76
+ "onInput"
77
+ ], Me = { class: "paper-actions" }, Ne = ["title", "aria-label"], Pe = {
78
+ class: "paper-check",
79
+ "aria-hidden": "true"
80
+ }, Fe = [
81
+ "title",
82
+ "aria-label",
83
+ "onClick"
84
+ ], Ie = [
85
+ "title",
86
+ "aria-label",
87
+ "onClick"
88
+ ], Le = {
89
+ key: 2,
90
+ class: "note-editor"
91
+ }, Re = {
92
+ class: "paper-copy",
93
+ "aria-hidden": "true"
94
+ }, ze = [
95
+ "aria-label",
96
+ "placeholder",
97
+ "value",
98
+ "tabindex",
99
+ "title",
100
+ "onFocus",
101
+ "onInput",
102
+ "onKeydown"
103
+ ], Be = {
104
+ key: 0,
105
+ class: "note-error",
106
+ role: "alert"
107
+ }, Ve = [
108
+ "aria-label",
109
+ "title",
110
+ "aria-expanded",
111
+ "aria-controls"
112
+ ], He = ["aria-label"], Ue = { class: "note-header" }, We = [
113
+ "aria-label",
114
+ "aria-pressed",
115
+ "title",
116
+ "aria-keyshortcuts"
117
+ ], Ge = {
118
+ viewBox: "0 0 16 16",
119
+ width: "14",
120
+ height: "14",
121
+ fill: "none",
122
+ stroke: "currentColor",
123
+ "stroke-width": "1.4",
124
+ "stroke-linecap": "round",
125
+ "aria-hidden": "true"
126
+ }, Ke = {
127
+ key: 0,
128
+ d: "m2 2 12 12"
129
+ }, qe = [
130
+ "title",
131
+ "aria-label",
132
+ "disabled",
133
+ "aria-busy"
134
+ ], Je = {
135
+ key: 0,
136
+ class: "note-empty"
137
+ }, Ye = { key: 1 }, Xe = ["title"], Ze = ["title", "onPointerdown"], Qe = {
138
+ key: 0,
139
+ class: "note-error",
140
+ role: "status"
141
+ }, $e = /*#__PURE__*/ e(/* @__PURE__ */ y({
142
+ __name: "PersonalNotes",
143
+ props: {
144
+ token: {},
145
+ provider: {},
146
+ shortcuts: { type: Function }
147
+ },
148
+ setup(e) {
149
+ let { t: y } = t(), O = ve(), k = o(), $e = r(), et = e.provider.placement?.homePath ?? i($e).home, tt = a($e.menus), nt = et === "/" ? (tt.find((e) => e.path === "/") ?? tt.find((e) => k.can(e.permission)))?.path ?? "/" : et, rt = (e, t, n) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.min(n, e)) : t, it = rt(e.provider.placement?.topSnapPx, 20, 100), at = {
150
+ x: rt(e.provider.placement?.initialPosition?.x, 12, 100),
151
+ y: rt(e.provider.placement?.initialPosition?.y, 15, 100)
152
+ }, ot = S(/* @__PURE__ */ new Map()), st = (e) => ot.get(e.note_id) ?? nt, ct = f(() => ee("notesHidden", e.shortcuts)), lt = f(() => ee("notesDone", e.shortcuts)), ut = (e) => y(`campus.personalTools.${e}`), A = C([]), j = C(), M = C(!1), N = S(/* @__PURE__ */ new Set()), P = S(/* @__PURE__ */ new Map()), F = S(/* @__PURE__ */ new Map()), I = /* @__PURE__ */ new Map(), dt = new AbortController(), L = dt.signal, R = 0, ft = 0, z = C(!1), B = C(!1);
153
+ function pt(e) {
154
+ !j.value?.enabled || e.defaultPrevented || e.isComposing || !ct.value?.matches(e) || e.target instanceof Element && e.target.closest("[aria-modal=\"true\"]") || (e.preventDefault(), !e.repeat && (B.value = !B.value, n.toast.success(B.value ? y("campus.personalTools.hiddenNotes") : y("campus.personalTools.shownNotes"))));
155
+ }
156
+ let V = (e) => P.get(e.note_id) ?? e.content, mt = (e) => V(e).split(/\r?\n/, 1)[0], H = (e) => mt(e).trim() || y("campus.personalTools.blank"), ht = (e) => V(e).replace(/^[^\n]*\n?/, ""), U = C({
157
+ width: window.innerWidth,
158
+ height: window.innerHeight
159
+ }), gt = C({
160
+ x: 0,
161
+ y: 0
162
+ }), W = C(), G = C(null);
163
+ function _t() {
164
+ let e = document.fullscreenElement;
165
+ G.value = e instanceof HTMLElement ? e : null;
166
+ }
167
+ de([G, W], ([e, t], n, r) => {
168
+ let i = e?.querySelector(".ca-content") ?? document.querySelector(".ca-content");
169
+ if (!i) return;
170
+ let a = () => {
171
+ let t = i.getBoundingClientRect();
172
+ gt.value = {
173
+ x: e ? 0 : Math.max(0, t.left),
174
+ y: Math.max(0, e ? t.bottom : t.top)
175
+ };
176
+ }, o = new ResizeObserver(a);
177
+ o.observe(i), t && o.observe(t), a(), r(() => o.disconnect());
178
+ }, {
179
+ immediate: !0,
180
+ flush: "post"
181
+ });
182
+ let vt = (e) => l(e.y, U.value.height, it), yt = f(() => B.value ? [] : A.value.filter((e) => e.floating && st(e) === O.path)), bt = f(() => yt.value.some(vt)), K = (e) => e.collapsed, xt = f(() => !!j.value && A.value.length < j.value.max_per_user);
183
+ async function q() {
184
+ let t = ++ft, n = R;
185
+ try {
186
+ let r = await e.provider.list(e.token, L);
187
+ if (L.aborted || ft !== t) return;
188
+ j.value = r.settings, n === R && !M.value && !N.size && (A.value = r.items), r.settings.enabled || $();
189
+ } catch {}
190
+ }
191
+ function St(e, t) {
192
+ let n = A.value.find((t) => t.note_id === e.note_id);
193
+ n && Object.assign(n, t, { updated_at: e.updated_at }), R++;
194
+ }
195
+ function Ct(e) {
196
+ L.aborted || n.toast.error(e instanceof Error ? e.message : y("campus.personalTools.failure"));
197
+ }
198
+ async function wt() {
199
+ if (xt.value && !M.value) {
200
+ M.value = !0;
201
+ try {
202
+ let t = await e.provider.create(e.token, L);
203
+ A.value.unshift(t), R++;
204
+ } catch (e) {
205
+ Ct(e);
206
+ } finally {
207
+ M.value = !1;
208
+ }
209
+ }
210
+ }
211
+ async function J(t, n) {
212
+ if (N.has(t.note_id)) return;
213
+ N.add(t.note_id);
214
+ let r = Object.fromEntries(Object.keys(n).map((e) => [e, t[e]]));
215
+ Object.assign(t, n);
216
+ try {
217
+ St(await e.provider.patch(e.token, L, t.note_id, n), n);
218
+ } catch (e) {
219
+ Object.assign(t, r), Ct(e);
220
+ } finally {
221
+ N.delete(t.note_id);
222
+ }
223
+ }
224
+ async function Tt(t) {
225
+ let r = t.note_id;
226
+ if (!N.has(r) && !(!await n.confirm(y("campus.personalTools.removeNote", { title: H(t) }), { type: "warning" }) || L.aborted || N.has(r))) {
227
+ N.add(r);
228
+ try {
229
+ await e.provider.remove(e.token, L, r), I.get(r)?.cancel(), I.delete(r), P.delete(r), F.delete(r), ot.delete(r), A.value = A.value.filter((e) => e.note_id !== r), R++;
230
+ } catch (e) {
231
+ Ct(e);
232
+ } finally {
233
+ N.delete(r);
234
+ }
235
+ }
236
+ }
237
+ function Et(t, n) {
238
+ let r = I.get(t);
239
+ r || (r = s(async () => {
240
+ let n = P.get(t);
241
+ if (!(n === void 0 || L.aborted)) {
242
+ if (!j.value?.enabled || [...n].length > j.value.max_content_length) F.set(t, j.value?.enabled ? y("campus.personalTools.noteTooLong") : y("campus.personalTools.notesDisabled"));
243
+ else try {
244
+ let r = await e.provider.patch(e.token, L, t, { content: n });
245
+ if (L.aborted || !P.has(t)) return;
246
+ St(r, { content: n }), P.get(t) === n && (P.delete(t), F.delete(t));
247
+ } catch (e) {
248
+ if (L.aborted || !P.has(t)) return;
249
+ F.set(t, e instanceof Error ? e.message : y("campus.personalTools.saveError"));
250
+ }
251
+ }
252
+ }), I.set(t, r)), r.schedule(n);
253
+ }
254
+ function Dt(e, t) {
255
+ j.value && (P.set(e.note_id, t), F.delete(e.note_id), Et(e.note_id, j.value.autosave_ms));
256
+ }
257
+ function Ot(e, t) {
258
+ let n = t.target, r = n.value;
259
+ Dt(e, r + V(e).slice(mt(e).length));
260
+ let i = r.indexOf("\n");
261
+ if (i < 0) return;
262
+ let a = Math.max(0, n.selectionStart - i - 1), o = n.closest("article")?.querySelector(".paper-body");
263
+ n.value = r.slice(0, i), oe(() => {
264
+ o?.focus({ preventScroll: !0 }), o?.setSelectionRange(a, a);
265
+ });
266
+ }
267
+ function kt(e, t) {
268
+ let n = V(e), r = n.indexOf("\n");
269
+ Dt(e, (r < 0 ? n + "\n" : n.slice(0, r + 1)) + t);
270
+ }
271
+ function At(e, t) {
272
+ if (t.defaultPrevented || t.isComposing || !lt.value?.matches(t)) return;
273
+ t.preventDefault();
274
+ let n = t.target, r = xe(n.value, n.selectionStart, n.selectionEnd);
275
+ r.text !== n.value && (n.value = r.text, kt(e, r.text), n.setSelectionRange(r.start, r.end), oe(() => n.setSelectionRange(r.start, r.end)));
276
+ }
277
+ function jt(e, t) {
278
+ V(e) || t.currentTarget.closest("article")?.querySelector(".paper-title")?.focus({ preventScroll: !0 });
279
+ }
280
+ function Mt(e, t) {
281
+ J(e, { collapsed: t });
282
+ }
283
+ let Nt = C(), Pt = C(), Ft = C();
284
+ function It(e) {
285
+ z.value &&= (e?.stopPropagation(), e && Nt.value?.contains(document.activeElement) && Pt.value?.focus({ preventScroll: !0 }), !1);
286
+ }
287
+ function Lt(e) {
288
+ e.target instanceof Node && !Ft.value?.contains(e.target) && It();
289
+ }
290
+ de(() => O.path, () => {
291
+ $(), It();
292
+ });
293
+ let Rt = C(""), zt = S(/* @__PURE__ */ new Map()), Bt = (e) => zt.get(e) ?? {
294
+ width: Math.min(280, U.value.width),
295
+ height: 0
296
+ }, Vt = new ResizeObserver((e) => {
297
+ for (let { target: t } of e) {
298
+ let e = t;
299
+ zt.set(e.dataset.noteId, {
300
+ width: e.offsetWidth,
301
+ height: e.offsetHeight
302
+ });
303
+ }
304
+ }), Ht = {
305
+ mounted: (e) => Vt.observe(e),
306
+ unmounted(e) {
307
+ Vt.unobserve(e), zt.delete(e.dataset.noteId);
308
+ }
309
+ };
310
+ function Ut() {
311
+ U.value = {
312
+ width: window.innerWidth,
313
+ height: window.innerHeight
314
+ };
315
+ }
316
+ function Wt(e, t) {
317
+ B.value = !1, ot.set(e.note_id, O.path), Rt.value = e.note_id, J(e, {
318
+ floating: !0,
319
+ ...t ? Gt(e, t) : {
320
+ x: e.x ?? at.x,
321
+ y: e.y ?? at.y
322
+ }
323
+ });
324
+ }
325
+ function Gt(e, t) {
326
+ let n = u(t, U.value, Bt(e.note_id));
327
+ return l(n.y, U.value.height, it) && (n.y = 0), n;
328
+ }
329
+ let Y, X = !1, Z = C(), Q = C();
330
+ function Kt(e, t, n) {
331
+ if (e.button !== 0 || Y || N.has(t.note_id)) return;
332
+ let r = e.currentTarget, i = {
333
+ x: e.clientX,
334
+ y: e.clientY
335
+ };
336
+ Rt.value = t.note_id;
337
+ let a = r.closest("article")?.getBoundingClientRect(), o = a ? {
338
+ x: a.left,
339
+ y: a.top
340
+ } : {
341
+ x: i.x - 24,
342
+ y: i.y - 16
343
+ };
344
+ r.setPointerCapture(e.pointerId), Y = {
345
+ note: t,
346
+ fromList: n,
347
+ target: r,
348
+ pointer: e.pointerId,
349
+ start: i,
350
+ origin: o
351
+ }, window.addEventListener("pointermove", qt), window.addEventListener("pointerup", Jt), window.addEventListener("pointercancel", Yt), window.addEventListener("blur", $);
352
+ }
353
+ function qt(e) {
354
+ if (!Y || Y.pointer !== e.pointerId) return;
355
+ let t = e.clientX - Y.start.x, n = e.clientY - Y.start.y;
356
+ if (!Z.value && Math.hypot(t, n) < 5) return;
357
+ Y.fromList && (Q.value = Y);
358
+ let r = ne({
359
+ x: Y.origin.x + t,
360
+ y: Y.origin.y + n
361
+ }, U.value, Bt(Y.note.note_id));
362
+ Z.value = {
363
+ x: r.x - Y.origin.x,
364
+ y: r.y - Y.origin.y
365
+ };
366
+ }
367
+ function $() {
368
+ let e = Y;
369
+ Y = void 0, Q.value = void 0, Z.value = void 0, window.removeEventListener("pointermove", qt), window.removeEventListener("pointerup", Jt), window.removeEventListener("pointercancel", Yt), window.removeEventListener("blur", $), e?.target.hasPointerCapture(e.pointer) && e.target.releasePointerCapture(e.pointer);
370
+ }
371
+ function Jt(e) {
372
+ if (!Y || Y.pointer !== e.pointerId) return;
373
+ qt(e);
374
+ let { note: t, fromList: n, origin: r } = Y;
375
+ X = !!Z.value && K(t) && !n;
376
+ let i = Z.value;
377
+ if ($(), !i) return;
378
+ let a = {
379
+ x: r.x + i.x,
380
+ y: r.y + i.y
381
+ };
382
+ if (n) {
383
+ let n = Nt.value?.getBoundingClientRect();
384
+ if (n && e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom) return;
385
+ Wt(t, a), It();
386
+ } else J(t, Gt(t, a));
387
+ }
388
+ function Yt(e) {
389
+ Y?.pointer === e.pointerId && $();
390
+ }
391
+ function Xt(e) {
392
+ let t = Z.value;
393
+ if (t && Y && !Y.fromList && Y.note.note_id === e.note_id) return {
394
+ position: "fixed",
395
+ left: `${Y.origin.x + t.x}px`,
396
+ top: `${Y.origin.y + t.y}px`,
397
+ zIndex: 1001
398
+ };
399
+ if (vt(e)) return { order: Math.round((e.x ?? 0) * 100) };
400
+ let { x: n, y: r } = c({
401
+ x: e.x,
402
+ y: e.y
403
+ }, U.value, Bt(e.note_id)), i = gt.value;
404
+ return {
405
+ left: `${Math.max(n, i.x)}px`,
406
+ top: `${Math.max(r, i.y)}px`,
407
+ "--note-room-width": `calc(100vw - ${i.x}px)`,
408
+ maxHeight: `calc(100dvh - ${i.y}px)`,
409
+ zIndex: Rt.value === e.note_id ? 2 : 1
410
+ };
411
+ }
412
+ function Zt(e) {
413
+ (P.size || N.size || M.value) && (e.preventDefault(), e.returnValue = !0);
414
+ }
415
+ return ce(() => {
416
+ q(), _t(), document.addEventListener("fullscreenchange", _t), document.addEventListener("pointerdown", Lt, !0), window.addEventListener("beforeunload", Zt), window.addEventListener("resize", Ut), window.addEventListener("focus", q), window.addEventListener("online", q), window.addEventListener("keydown", pt, !0);
417
+ }), le(() => {
418
+ dt.abort(), document.removeEventListener("pointerdown", Lt, !0), document.removeEventListener("fullscreenchange", _t), $(), Vt.disconnect();
419
+ for (let e of I.values()) e.cancel();
420
+ window.removeEventListener("beforeunload", Zt), window.removeEventListener("resize", Ut), window.removeEventListener("focus", q), window.removeEventListener("online", q), window.removeEventListener("keydown", pt, !0);
421
+ }), (t, n) => {
422
+ let r = ue("ca-button");
423
+ return x(), h(d, null, [(x(), p(re, {
424
+ to: G.value ?? "body",
425
+ disabled: !G.value
426
+ }, [j.value?.enabled ? (x(), h("div", Se, [
427
+ bt.value ? (x(), p(re, {
428
+ key: 0,
429
+ defer: "",
430
+ to: G.value ?? ".ca-shell"
431
+ }, [g("aside", {
432
+ ref_key: "dock",
433
+ ref: W,
434
+ class: "notes-dock",
435
+ "aria-label": E(y)("campus.personalTools.dock")
436
+ }, null, 8, Ce)], 8, ["to"])) : m("v-if", !0),
437
+ (x(!0), h(d, null, w(yt.value, (e) => (x(), p(re, {
438
+ key: e.note_id,
439
+ to: W.value ?? "body",
440
+ disabled: !W.value || !vt(e)
441
+ }, [fe((x(), h("article", {
442
+ "data-note-id": e.note_id,
443
+ class: b(["note-card", [`note-${e.color}`, { "note-card--collapsed": K(e) }]]),
444
+ style: se(Xt(e)),
445
+ onPointerdown: (t) => Rt.value = e.note_id
446
+ }, [K(e) ? (x(), h("button", {
447
+ key: 0,
448
+ type: "button",
449
+ class: "paper-corner",
450
+ "aria-label": E(y)("campus.personalTools.expand", { title: H(e) }),
451
+ "aria-expanded": "false",
452
+ title: H(e),
453
+ onPointerdown: (t) => {
454
+ ae(X) ? X.value = !1 : X = !1, Kt(t, e, !1);
455
+ },
456
+ onClick: (t) => (t.detail === 0 || !E(X)) && Mt(e, !1)
457
+ }, [g("span", Ee, T(H(e)), 1)], 40, Te)) : (x(), h("header", De, [
458
+ g("span", {
459
+ class: "paper-grip",
460
+ title: E(y)("campus.personalTools.dragNote"),
461
+ onPointerdown: (t) => Kt(t, e, !1)
462
+ }, [(x(), h("svg", ke, [(x(), h(d, null, w([
463
+ 5,
464
+ 8,
465
+ 11
466
+ ], (e) => g("circle", {
467
+ key: e,
468
+ cx: e,
469
+ cy: "8",
470
+ r: "1"
471
+ }, null, 8, Ae)), 64))]))], 40, Oe),
472
+ g("textarea", {
473
+ class: "paper-title",
474
+ "aria-label": E(y)("campus.personalTools.noteTitle"),
475
+ placeholder: E(y)("campus.personalTools.blank"),
476
+ rows: "1",
477
+ wrap: "off",
478
+ title: H(e),
479
+ value: mt(e),
480
+ onInput: (t) => Ot(e, t)
481
+ }, null, 40, je),
482
+ g("div", Me, [
483
+ v(E(me), {
484
+ trigger: "click",
485
+ placement: "bottom-end",
486
+ "show-arrow": !1,
487
+ persistent: !1,
488
+ "append-to": G.value ?? void 0,
489
+ "popper-class": "ca-personal-note-colors",
490
+ disabled: N.has(e.note_id),
491
+ onCommand: (t) => J(e, { color: t })
492
+ }, {
493
+ dropdown: D(() => [v(E(ge), {
494
+ class: b(["paper-palette", `note-${e.color}`]),
495
+ "aria-label": E(y)("campus.personalTools.colors")
496
+ }, {
497
+ default: D(() => [(x(!0), h(d, null, w(E(te), (t) => (x(), p(E(he), {
498
+ class: "paper-color-item",
499
+ key: t,
500
+ command: t,
501
+ "aria-current": t === e.color ? "true" : void 0
502
+ }, {
503
+ default: D(() => [
504
+ g("span", {
505
+ class: b(["paper-swatch", `note-${t}`]),
506
+ "aria-hidden": "true"
507
+ }, null, 2),
508
+ _(" " + T(ut(t)), 1),
509
+ g("span", Pe, T(t === e.color ? "✓" : ""), 1)
510
+ ]),
511
+ _: 2
512
+ }, 1032, ["command", "aria-current"]))), 128))]),
513
+ _: 2
514
+ }, 1032, ["class", "aria-label"])]),
515
+ default: D(() => [g("button", {
516
+ type: "button",
517
+ class: "paper-icon",
518
+ title: E(y)("campus.personalTools.colorName", { color: ut(e.color) }),
519
+ "aria-label": E(y)("campus.personalTools.currentColor", { color: ut(e.color) })
520
+ }, [...n[2] ||= [g("span", {
521
+ class: "paper-swatch",
522
+ "aria-hidden": "true"
523
+ }, null, -1)]], 8, Ne)]),
524
+ _: 2
525
+ }, 1032, [
526
+ "append-to",
527
+ "disabled",
528
+ "onCommand"
529
+ ]),
530
+ g("button", {
531
+ type: "button",
532
+ class: "paper-icon",
533
+ title: E(y)("campus.personalTools.collapse"),
534
+ "aria-label": E(y)("campus.personalTools.collapse"),
535
+ "aria-expanded": "true",
536
+ onClick: (t) => Mt(e, !0)
537
+ }, [...n[3] ||= [g("svg", {
538
+ viewBox: "0 0 16 16",
539
+ width: "14",
540
+ height: "14",
541
+ fill: "none",
542
+ stroke: "currentColor",
543
+ "stroke-linecap": "round",
544
+ "aria-hidden": "true"
545
+ }, [g("path", { d: "M4.5 9.5 8 6l3.5 3.5" })], -1)]], 8, Fe),
546
+ g("button", {
547
+ type: "button",
548
+ class: "paper-icon",
549
+ title: E(y)("campus.personalTools.returnNote"),
550
+ "aria-label": E(y)("campus.personalTools.returnNote"),
551
+ onClick: (t) => J(e, { floating: !1 })
552
+ }, [...n[4] ||= [g("svg", {
553
+ viewBox: "0 0 16 16",
554
+ width: "14",
555
+ height: "14",
556
+ fill: "none",
557
+ stroke: "currentColor",
558
+ "stroke-linejoin": "round",
559
+ "aria-hidden": "true"
560
+ }, [g("path", { d: "M2.5 8 4.5 4h7l2 4v4h-11zM2.5 8H6l1 1.5h2L10 8h3.5" })], -1)]], 8, Ie)
561
+ ])
562
+ ])), K(e) ? m("v-if", !0) : (x(), h("div", Le, [g("div", { class: b(["paper-writing", { "has-done": E(be)(ht(e)) }]) }, [g("div", Re, [(x(!0), h(d, null, w(E(ye)(ht(e)), (e, t) => (x(), h(d, { key: t }, [g("span", { class: b({ "paper-line--done": e.done }) }, T(e.text), 3), n[5] ||= _(T("\n"), -1)], 64))), 128))]), g("textarea", {
563
+ class: "paper-body",
564
+ "aria-label": E(y)("campus.personalTools.noteBody"),
565
+ placeholder: E(y)("campus.personalTools.notePlaceholder"),
566
+ rows: "1",
567
+ value: ht(e),
568
+ tabindex: V(e) ? 0 : -1,
569
+ title: [lt.value?.label, E(y)("campus.personalTools.markLine")].filter(Boolean).join(" · "),
570
+ onFocus: (t) => jt(e, t),
571
+ onInput: (t) => kt(e, t.target.value),
572
+ onKeydown: (t) => At(e, t)
573
+ }, null, 40, ze)], 2), F.has(e.note_id) ? (x(), h("div", Be, [g("span", null, T(E(y)("campus.personalTools.saveDetail", { message: F.get(e.note_id) })), 1), v(r, {
574
+ class: "note-list-button",
575
+ size: "small",
576
+ text: "",
577
+ onClick: (t) => Et(e.note_id, 0)
578
+ }, {
579
+ default: D(() => [_(T(E(y)("campus.personalTools.retry")), 1)]),
580
+ _: 1
581
+ }, 8, ["onClick"])])) : m("v-if", !0)]))], 46, we)), [[Ht]])], 8, ["to", "disabled"]))), 128)),
582
+ Q.value && Z.value ? (x(), h("div", {
583
+ key: 1,
584
+ class: b(["ca-card note-ghost", `note-${Q.value.note.color}`]),
585
+ "aria-hidden": "true",
586
+ style: se({
587
+ left: `${Q.value.origin.x}px`,
588
+ top: `${Q.value.origin.y}px`,
589
+ transform: `translate(${Z.value.x}px, ${Z.value.y}px)`
590
+ })
591
+ }, T(H(Q.value.note)), 7)) : m("v-if", !0)
592
+ ])) : m("v-if", !0)], 8, ["to", "disabled"])), j.value?.enabled ? (x(), h("div", {
593
+ key: 0,
594
+ ref_key: "menu",
595
+ ref: Ft,
596
+ class: "notes-menu",
597
+ onKeydown: pe(It, ["esc"])
598
+ }, [g("button", {
599
+ ref_key: "entry",
600
+ ref: Pt,
601
+ type: "button",
602
+ class: "ca-personal-entry",
603
+ "aria-label": z.value ? E(y)("campus.personalTools.closeNotes") : E(y)("campus.personalTools.notes"),
604
+ title: z.value ? E(y)("campus.personalTools.closeNotes") : E(y)("campus.personalTools.notes"),
605
+ "aria-expanded": z.value,
606
+ "aria-controls": z.value ? "ca-personal-notes-list" : void 0,
607
+ onClick: n[0] ||= (e) => z.value = !z.value
608
+ }, [v(E(_e), {
609
+ name: e.provider.icon ?? "edit",
610
+ size: 18,
611
+ fallback: "edit",
612
+ "aria-hidden": "true"
613
+ }, null, 8, ["name"])], 8, Ve), v(ie, { name: "notes-dropdown" }, {
614
+ default: D(() => [z.value ? (x(), h("section", {
615
+ key: 0,
616
+ id: "ca-personal-notes-list",
617
+ ref_key: "panel",
618
+ ref: Nt,
619
+ class: "ca-card note-list",
620
+ "aria-label": E(y)("campus.personalTools.notesList")
621
+ }, [g("header", Ue, [
622
+ g("strong", null, [_(T(E(y)("campus.personalTools.notes")) + " ", 1), g("small", null, T(A.value.length) + " / " + T(j.value.max_per_user), 1)]),
623
+ g("button", {
624
+ type: "button",
625
+ class: "note-action",
626
+ "aria-label": E(y)("campus.personalTools.hideNotes"),
627
+ "aria-pressed": B.value,
628
+ title: [B.value ? E(y)("campus.personalTools.showNotes") : E(y)("campus.personalTools.hideNotes"), ct.value?.label].filter(Boolean).join(" · "),
629
+ "aria-keyshortcuts": ct.value?.aria,
630
+ onClick: n[1] ||= (e) => B.value = !B.value
631
+ }, [(x(), h("svg", Ge, [
632
+ n[6] ||= g("path", { d: "M1.5 8s2.4-4.5 6.5-4.5 6.5 4.5 6.5 4.5-2.4 4.5-6.5 4.5S1.5 8 1.5 8Z" }, null, -1),
633
+ n[7] ||= g("circle", {
634
+ cx: "8",
635
+ cy: "8",
636
+ r: "1.8"
637
+ }, null, -1),
638
+ B.value ? (x(), h("path", Ke)) : m("v-if", !0)
639
+ ]))], 8, We),
640
+ g("button", {
641
+ type: "button",
642
+ class: "note-action",
643
+ title: E(y)("campus.personalTools.newNote"),
644
+ "aria-label": E(y)("campus.personalTools.newNote"),
645
+ disabled: !xt.value || M.value,
646
+ "aria-busy": M.value,
647
+ onClick: wt
648
+ }, [...n[8] ||= [g("svg", {
649
+ viewBox: "0 0 16 16",
650
+ width: "14",
651
+ height: "14",
652
+ fill: "none",
653
+ stroke: "currentColor",
654
+ "stroke-width": "1.6",
655
+ "stroke-linecap": "round",
656
+ "aria-hidden": "true"
657
+ }, [g("path", { d: "M8 3v10M3 8h10" })], -1)]], 8, qe)
658
+ ]), A.value.length ? (x(), h("ul", Ye, [(x(!0), h(d, null, w(A.value, (e) => (x(), h("li", { key: e.note_id }, [
659
+ g("span", {
660
+ class: b(["note-dot", `note-${e.color}`]),
661
+ title: ut(e.color)
662
+ }, null, 10, Xe),
663
+ g("span", {
664
+ class: "note-grip",
665
+ title: H(e),
666
+ onPointerdown: (t) => !e.floating && Kt(t, e, !0)
667
+ }, T(H(e)), 41, Ze),
668
+ F.has(e.note_id) ? (x(), h("span", Qe, T(E(y)("campus.personalTools.unsaved")), 1)) : m("v-if", !0),
669
+ !e.floating || st(e) !== E(O).path ? (x(), p(r, {
670
+ key: 1,
671
+ class: "note-list-button",
672
+ size: "small",
673
+ text: "",
674
+ onClick: (t) => Wt(e)
675
+ }, {
676
+ default: D(() => [_(T(E(y)("campus.personalTools.pin")), 1)]),
677
+ _: 1
678
+ }, 8, ["onClick"])) : (x(), p(r, {
679
+ key: 2,
680
+ class: "note-list-button",
681
+ size: "small",
682
+ text: "",
683
+ onClick: (t) => J(e, { floating: !1 })
684
+ }, {
685
+ default: D(() => [_(T(E(y)("campus.personalTools.returnNote")), 1)]),
686
+ _: 1
687
+ }, 8, ["onClick"])),
688
+ v(r, {
689
+ class: "note-list-button",
690
+ size: "small",
691
+ text: "",
692
+ onClick: (t) => Tt(e)
693
+ }, {
694
+ default: D(() => [_(T(E(y)("campus.personalTools.remove")), 1)]),
695
+ _: 1
696
+ }, 8, ["onClick"])
697
+ ]))), 128))])) : (x(), h("p", Je, T(E(y)("campus.personalTools.emptyNotes")), 1))], 8, He)) : m("v-if", !0)]),
698
+ _: 1
699
+ })], 544)) : m("v-if", !0)], 64);
700
+ };
701
+ }
702
+ }), [["__scopeId", "data-v-15a5f00c"]]);
703
+ export { $e as default };