@floegence/floe-webapp-core 0.78.9 → 0.79.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,27 +1,28 @@
1
- import { createSignal as a, createMemo as c, createEffect as p, onCleanup as z, untrack as Ne } from "solid-js";
1
+ import { createSignal as l, createMemo as c, createEffect as p, onCleanup as Q, untrack as Ne } from "solid-js";
2
+ import { useMobileLayout as wo } from "../../context/LayoutContext.js";
2
3
  import { Paste as vo, Plus as To, Trash as go } from "../icons/index.js";
3
4
  import { NOTES_CONTEXT_MENU_WIDTH_PX as yo, estimateNotesContextMenuHeight as No } from "./NotesContextMenu.js";
4
- import { samePoint as xe, resolveFrameSize as J, resolveOverviewBounds as xo, createOverviewItem as bo, clamp as P, createContextMenuPosition as Co, NOTES_MOBILE_BREAKPOINT_PX as Mo, getNormalizedOverviewPoint as ft, normalizeNoteText as mt, findTrashTopicNoteCount as _o, hasLiveNotesForTopic as Po, NOTES_CANVAS_ZOOM_STEP as ht, resolveCenteredViewport as Io } from "./notesOverlayHelpers.js";
5
- import { numberNotesInTopic as So, resolveNotesDigitSequence as ee } from "./notesNumbering.js";
6
- import { normalizeNotesSnapshot as Do, groupTrashItems as ko, visibleWorldRect as Oo, computeBoardBounds as Xo } from "./types.js";
7
- import { useNotification as Eo } from "../../context/NotificationContext.js";
8
- const Lo = 650;
5
+ import { samePoint as xe, resolveFrameSize as J, resolveOverviewBounds as xo, createOverviewItem as bo, clamp as P, createContextMenuPosition as Co, getNormalizedOverviewPoint as ft, normalizeNoteText as mt, findTrashTopicNoteCount as Mo, hasLiveNotesForTopic as _o, NOTES_CANVAS_ZOOM_STEP as ht, resolveCenteredViewport as Po } from "./notesOverlayHelpers.js";
6
+ import { numberNotesInTopic as Io, resolveNotesDigitSequence as ee } from "./notesNumbering.js";
7
+ import { normalizeNotesSnapshot as Do, groupTrashItems as So, visibleWorldRect as ko, computeBoardBounds as Oo } from "./types.js";
8
+ import { useNotification as Xo } from "../../context/NotificationContext.js";
9
+ const Yo = 650;
9
10
  function h(r) {
10
11
  return r instanceof Error ? r.message : String(r);
11
12
  }
12
13
  function jo(r) {
13
- const s = Eo();
14
+ const s = Xo();
14
15
  let be = 1, te = /* @__PURE__ */ new Set();
15
- const F = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), [Ce, wt] = a(), [I, vt] = a({ width: 0, height: 0 }), [v, u] = a(null), [Me, _e] = a(""), [B, Pe] = a(null), [Ie, oe] = a(""), [V, S] = a(null), [ne, Se] = a(""), [De, ke] = a(""), [Oe, Xe] = a("amber"), [re, Ee] = a(!1), [Le, Ye] = a(!1), [j, Re] = a(null), [ie, ce] = a(""), [Tt, C] = a(null), [D, se] = a(""), [gt, yt] = a(Date.now()), [Nt, xt] = a(!1), [ze, T] = a(null), [bt, Fe] = a(null), [Ae, k] = a(null), [Be, $] = a(/* @__PURE__ */ new Map());
16
+ const F = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), [Ce, wt] = l(), [I, vt] = l({ width: 0, height: 0 }), [v, u] = l(null), [Me, _e] = l(""), [A, Pe] = l(null), [Ie, oe] = l(""), [B, D] = l(null), [ne, De] = l(""), [Se, ke] = l(""), [Oe, Xe] = l("amber"), [re, Ye] = l(!1), [Le, Re] = l(!1), [V, Ee] = l(null), [ie, ce] = l(""), [Tt, C] = l(null), [S, se] = l(""), [gt, yt] = l(Date.now()), Nt = wo(), [Fe, T] = l(null), [xt, ze] = l(null), [Ae, k] = l(null), [Be, j] = l(/* @__PURE__ */ new Map());
16
17
  let O, N, ae, le = null;
17
18
  const d = c(() => Do(r.controller.snapshot())), x = c(
18
19
  () => d().topics.filter((e) => e.deleted_at_unix_ms <= 0)
19
- ), Ct = c(() => x().length), b = c(() => {
20
+ ), bt = c(() => x().length), b = c(() => {
20
21
  const e = r.controller.activeTopicID();
21
22
  return x().some((t) => t.topic_id === e) ? e : x()[0]?.topic_id ?? "";
22
23
  }), X = c(
23
24
  () => x().find((e) => e.topic_id === b())
24
- ), Mt = c(() => {
25
+ ), Ct = c(() => {
25
26
  const e = Be();
26
27
  return d().items.map((t) => {
27
28
  const o = e.get(t.note_id);
@@ -31,32 +32,32 @@ function jo(r) {
31
32
  y: o.y
32
33
  };
33
34
  });
34
- }), W = c(
35
- () => Mt().filter((e) => e.topic_id === b())
36
- ), E = c(
37
- () => So(d().items, b())
38
- ), _t = c(
39
- () => new Map(E().map((e) => [e.item.note_id, e.label]))
40
- ), Pt = c(() => ko(d().trash_items)), Ve = c(() => d().trash_items.length), It = c(() => d().items.length), St = c(
41
- () => W().reduce((e, t) => Math.max(e, t.z_index), 1)
42
- ), g = c(() => Ae() ?? r.controller.viewport()), Dt = c(() => X()?.name ?? "No topic"), kt = c(() => `${Math.round(g().scale * 100)}%`), Ot = c(() => {
35
+ }), $ = c(
36
+ () => Ct().filter((e) => e.topic_id === b())
37
+ ), Y = c(
38
+ () => Io(d().items, b())
39
+ ), Mt = c(
40
+ () => new Map(Y().map((e) => [e.item.note_id, e.label]))
41
+ ), _t = c(() => So(d().trash_items)), Ve = c(() => d().trash_items.length), Pt = c(() => d().items.length), It = c(
42
+ () => $().reduce((e, t) => Math.max(e, t.z_index), 1)
43
+ ), g = c(() => Ae() ?? r.controller.viewport()), Dt = c(() => X()?.name ?? "No topic"), St = c(() => `${Math.round(g().scale * 100)}%`), kt = c(() => {
43
44
  const e = J(I());
44
- return Oo(g(), e.width, e.height);
45
- }), q = c(
46
- () => xo(Xo(W()), Ot())
47
- ), Xt = c(
48
- () => W().map((e) => bo(e, q()))
45
+ return ko(g(), e.width, e.height);
46
+ }), W = c(
47
+ () => xo(Oo($()), kt())
48
+ ), Ot = c(
49
+ () => $().map((e) => bo(e, W()))
49
50
  ), je = c(() => {
50
- const e = q(), t = J(I()), o = g(), n = -o.x / o.scale, i = -o.y / o.scale, l = t.width / o.scale, f = t.height / o.scale, m = P(n, e.minX, e.maxX), M = P(i, e.minY, e.maxY), _ = P(n + l, e.minX, e.maxX), ye = P(i + f, e.minY, e.maxY), R = Math.max((_ - m) / e.width * 100, 6), y = Math.max((ye - M) / e.height * 100, 8), ut = (m - e.minX) / e.width * 100, pt = (M - e.minY) / e.height * 100;
51
+ const e = W(), t = J(I()), o = g(), n = -o.x / o.scale, i = -o.y / o.scale, a = t.width / o.scale, f = t.height / o.scale, m = P(n, e.minX, e.maxX), M = P(i, e.minY, e.maxY), _ = P(n + a, e.minX, e.maxX), ye = P(i + f, e.minY, e.maxY), E = Math.max((_ - m) / e.width * 100, 6), y = Math.max((ye - M) / e.height * 100, 8), ut = (m - e.minX) / e.width * 100, pt = (M - e.minY) / e.height * 100;
51
52
  return {
52
53
  left: ut,
53
54
  top: pt,
54
- width: R,
55
+ width: E,
55
56
  height: y,
56
- centerX: ut + R / 2,
57
+ centerX: ut + E / 2,
57
58
  centerY: pt + y / 2
58
59
  };
59
- }), Et = c(() => {
60
+ }), Xt = c(() => {
60
61
  const e = je();
61
62
  return {
62
63
  left: `${e.left}%`,
@@ -65,121 +66,121 @@ function jo(r) {
65
66
  height: `${e.height}%`
66
67
  };
67
68
  }), $e = c(() => {
68
- const e = V();
69
+ const e = B();
69
70
  return e ? d().items.find((t) => t.note_id === e) : void 0;
70
71
  }), We = c(
71
- () => !!(V() || j() || B() || v() || re())
72
- ), Lt = c(() => {
73
- const e = D();
72
+ () => !!(B() || V() || A() || v() || re())
73
+ ), Yt = c(() => {
74
+ const e = S();
74
75
  if (!e) return null;
75
- const t = ee(e, E());
76
+ const t = ee(e, Y());
76
77
  return t.kind !== "pending" ? null : t.exactMatch?.item.note_id ?? null;
77
78
  }), de = (e) => Ne(() => d().items.some((t) => t.note_id === e)), qe = () => {
78
79
  const e = be;
79
80
  return be += 1, e;
80
- }, Yt = (e) => {
81
+ }, Lt = (e) => {
81
82
  const t = qe();
82
83
  return F.set(e, t), t;
83
84
  }, Rt = (e) => {
84
85
  const t = qe();
85
- return A.set(e, t), t;
86
- }, He = (e, t) => F.get(e) === t, Ge = (e, t) => A.get(e) === t, ue = (e) => {
86
+ return z.set(e, t), t;
87
+ }, He = (e, t) => F.get(e) === t, Ge = (e, t) => z.get(e) === t, ue = (e) => {
87
88
  F.delete(e);
88
89
  }, pe = (e) => {
89
- A.delete(e);
90
+ z.delete(e);
90
91
  }, fe = (e) => {
91
- ue(e), pe(e), H(e), T((t) => t === e ? null : t);
92
- }, zt = (e) => {
92
+ ue(e), pe(e), q(e), T((t) => t === e ? null : t);
93
+ }, Et = (e) => {
93
94
  for (const t of d().items)
94
95
  t.topic_id === e && fe(t.note_id);
95
96
  }, Ft = (e) => {
96
- fe(e), L(), C((t) => t === e ? null : t), u((t) => t?.noteID === e ? null : t), S((t) => t === e ? null : t);
97
- }, At = () => {
98
- F.clear(), A.clear();
97
+ fe(e), L(), C((t) => t === e ? null : t), u((t) => t?.noteID === e ? null : t), D((t) => t === e ? null : t);
98
+ }, zt = () => {
99
+ F.clear(), z.clear();
99
100
  }, L = () => {
100
101
  O !== void 0 && (window.clearTimeout(O), O = void 0);
101
102
  }, w = () => {
102
103
  N !== void 0 && (window.clearTimeout(N), N = void 0), se("");
103
104
  }, Ue = (e, t) => {
104
- $((o) => {
105
+ j((o) => {
105
106
  const n = o.get(e);
106
107
  if (n && xe(n, t)) return o;
107
108
  const i = new Map(o);
108
109
  return i.set(e, t), i;
109
110
  });
110
- }, H = (e) => {
111
- $((t) => {
111
+ }, q = (e) => {
112
+ j((t) => {
112
113
  if (!t.has(e)) return t;
113
114
  const o = new Map(t);
114
115
  return o.delete(e), o;
115
116
  });
117
+ }, H = () => {
118
+ Ee(null), ce("");
116
119
  }, G = () => {
117
- Re(null), ce("");
120
+ D(null);
121
+ }, R = () => {
122
+ Re(!1);
123
+ }, Ze = () => {
124
+ Re(!0);
118
125
  }, U = () => {
119
- S(null);
120
- }, Y = () => {
121
126
  Ye(!1);
122
- }, Ke = () => {
123
- Ye(!0);
124
- }, K = () => {
125
- Ee(!1);
126
127
  }, me = () => {
127
- Ee(!0);
128
+ Ye(!0);
128
129
  }, Z = () => {
129
130
  Pe(null), oe("");
131
+ }, At = () => {
132
+ u(null), U(), R(), G(), H(), j(/* @__PURE__ */ new Map()), zt();
130
133
  }, Bt = () => {
131
- u(null), K(), Y(), U(), G(), $(/* @__PURE__ */ new Map()), At();
132
- }, Vt = () => {
133
134
  if (v()) {
134
135
  u(null);
135
136
  return;
136
137
  }
137
- if (V()) {
138
- U();
138
+ if (B()) {
139
+ G();
139
140
  return;
140
141
  }
141
- if (j()) {
142
- G();
142
+ if (V()) {
143
+ H();
143
144
  return;
144
145
  }
145
146
  if (Le()) {
146
- Y();
147
+ R();
147
148
  return;
148
149
  }
149
150
  if (re()) {
150
- K();
151
+ U();
151
152
  return;
152
153
  }
153
154
  r.onClose();
154
- }, Q = (e) => {
155
+ }, K = (e) => {
155
156
  r.controller.setActiveTopicID(e);
156
- }, Ze = (e) => Po(d().items, e), jt = (e, t, o = X()?.topic_id) => {
157
+ }, Ke = (e) => _o(d().items, e), Vt = (e, t, o = X()?.topic_id) => {
157
158
  if (!o) return null;
158
159
  const n = x().find((m) => m.topic_id === o);
159
160
  if (!n) return null;
160
161
  const i = Ce();
161
162
  if (!i) return null;
162
- const l = i.getBoundingClientRect();
163
- if (l.width <= 0 || l.height <= 0 || e < l.left || e > l.right || t < l.top || t > l.bottom)
163
+ const a = i.getBoundingClientRect();
164
+ if (a.width <= 0 || a.height <= 0 || e < a.left || e > a.right || t < a.top || t > a.bottom)
164
165
  return null;
165
166
  const f = g();
166
167
  return {
167
168
  topicID: n.topic_id,
168
- worldX: (e - l.left - f.x) / f.scale,
169
- worldY: (t - l.top - f.y) / f.scale
169
+ worldX: (e - a.left - f.x) / f.scale,
170
+ worldY: (t - a.top - f.y) / f.scale
170
171
  };
171
- }, $t = (e, t) => {
172
+ }, jt = (e, t) => {
172
173
  if (typeof document > "u") return [];
173
174
  if (typeof document.elementsFromPoint == "function")
174
175
  return document.elementsFromPoint(e, t);
175
176
  const o = document.elementFromPoint(e, t);
176
177
  return o ? [o] : [];
177
- }, Wt = (e, t) => {
178
- const o = $t(e, t).filter((n) => n instanceof HTMLElement).map((n) => n.closest("[data-floe-notes-note-id]")).find(Boolean)?.dataset.floeNotesNoteId?.trim();
178
+ }, $t = (e, t) => {
179
+ const o = jt(e, t).filter((n) => n instanceof HTMLElement).map((n) => n.closest("[data-floe-notes-note-id]")).find(Boolean)?.dataset.floeNotesNoteId?.trim();
179
180
  if (o)
180
181
  return d().items.find((n) => n.note_id === o);
181
182
  }, he = (e, t, o) => {
182
- const n = jt(e, t, o?.topicID);
183
+ const n = Vt(e, t, o?.topicID);
183
184
  return n ? {
184
185
  clientX: e,
185
186
  clientY: t,
@@ -200,8 +201,8 @@ function jo(r) {
200
201
  }, Je = (e, t, o) => {
201
202
  const n = he(e, t, o);
202
203
  return n ? (u(n), !0) : !1;
203
- }, qt = (e, t) => {
204
- const o = Wt(e, t);
204
+ }, Wt = (e, t) => {
205
+ const o = $t(e, t);
205
206
  if (o) {
206
207
  Te(o.note_id);
207
208
  const n = he(e, t, {
@@ -214,23 +215,23 @@ function jo(r) {
214
215
  u(he(e, t));
215
216
  }, et = (e) => {
216
217
  k(e), r.controller.setViewport(e), k(null);
217
- }, tt = (e, t, o) => Io({
218
+ }, tt = (e, t, o) => Po({
218
219
  viewport: g(),
219
220
  frame: I(),
220
- bounds: q(),
221
+ bounds: W(),
221
222
  worldX: e,
222
223
  worldY: t,
223
224
  scale: o
224
225
  }), ot = (e) => {
225
- const t = g(), o = J(I()), n = (o.width / 2 - t.x) / t.scale, i = (o.height / 2 - t.y) / t.scale, l = e === "in" ? t.scale * ht : t.scale / ht;
226
- et(tt(n, i, l));
226
+ const t = g(), o = J(I()), n = (o.width / 2 - t.x) / t.scale, i = (o.height / 2 - t.y) / t.scale, a = e === "in" ? t.scale * ht : t.scale / ht;
227
+ et(tt(n, i, a));
227
228
  }, nt = (e, t, o) => {
228
229
  const n = o.surfaceRect;
229
230
  if (n.width <= 0 || n.height <= 0) return;
230
- const i = ft(e, t, n), l = P(i.x - o.centerOffsetX, 0, 1), f = P(i.y - o.centerOffsetY, 0, 1), m = o.bounds;
231
+ const i = ft(e, t, n), a = P(i.x - o.centerOffsetX, 0, 1), f = P(i.y - o.centerOffsetY, 0, 1), m = o.bounds;
231
232
  k(
232
233
  tt(
233
- m.minX + l * m.width,
234
+ m.minX + a * m.width,
234
235
  m.minY + f * m.height
235
236
  )
236
237
  );
@@ -239,31 +240,31 @@ function jo(r) {
239
240
  const t = Ae();
240
241
  t && r.controller.setViewport(t);
241
242
  }
242
- k(null), Fe(null);
243
- }, Ht = (e) => {
243
+ k(null), ze(null);
244
+ }, qt = (e) => {
244
245
  if (e.button !== 0 && e.pointerType !== "touch" && e.pointerType !== "pen")
245
246
  return;
246
247
  const t = e.currentTarget, o = t.getBoundingClientRect();
247
248
  if (o.width <= 0 || o.height <= 0) return;
248
- const n = ft(e.clientX, e.clientY, o), i = je(), l = n.x * 100, f = n.y * 100, m = l >= i.left && l <= i.left + i.width && f >= i.top && f <= i.top + i.height, M = {
249
+ const n = ft(e.clientX, e.clientY, o), i = je(), a = n.x * 100, f = n.y * 100, m = a >= i.left && a <= i.left + i.width && f >= i.top && f <= i.top + i.height, M = {
249
250
  pointerId: e.pointerId,
250
- bounds: q(),
251
+ bounds: W(),
251
252
  surfaceRect: o,
252
253
  centerOffsetX: m ? n.x - i.centerX / 100 : 0,
253
254
  centerOffsetY: m ? n.y - i.centerY / 100 : 0
254
255
  };
255
- we(!1), e.preventDefault(), e.stopPropagation(), Fe(M), nt(e.clientX, e.clientY, M), t.setPointerCapture?.(e.pointerId);
256
+ we(!1), e.preventDefault(), e.stopPropagation(), ze(M), nt(e.clientX, e.clientY, M), t.setPointerCapture?.(e.pointerId);
256
257
  const _ = new AbortController();
257
258
  ae = _;
258
259
  const ye = (y) => {
259
260
  y.pointerId === e.pointerId && nt(y.clientX, y.clientY, M);
260
- }, R = (y) => {
261
+ }, E = (y) => {
261
262
  y.pointerId === e.pointerId && (t.hasPointerCapture?.(e.pointerId) && t.releasePointerCapture(e.pointerId), we(!0));
262
263
  };
263
- t.addEventListener("pointermove", ye, { signal: _.signal }), t.addEventListener("pointerup", R, {
264
+ t.addEventListener("pointermove", ye, { signal: _.signal }), t.addEventListener("pointerup", E, {
264
265
  once: !0,
265
266
  signal: _.signal
266
- }), t.addEventListener("pointercancel", R, {
267
+ }), t.addEventListener("pointercancel", E, {
267
268
  once: !0,
268
269
  signal: _.signal
269
270
  });
@@ -275,7 +276,7 @@ function jo(r) {
275
276
  y: e.worldY,
276
277
  body: ""
277
278
  });
278
- S(t.note_id);
279
+ D(t.note_id);
279
280
  } catch (t) {
280
281
  s.error("Create failed", h(t));
281
282
  }
@@ -291,7 +292,7 @@ function jo(r) {
291
292
  s.error("Paste failed", h(o));
292
293
  }
293
294
  }, ct = (e) => {
294
- ce(""), Re(e);
295
+ ce(""), Ee(e);
295
296
  }, st = async (e) => {
296
297
  try {
297
298
  const t = await navigator.clipboard.readText();
@@ -319,22 +320,22 @@ function jo(r) {
319
320
  } catch {
320
321
  s.error("Copy failed", "Clipboard write was not available.");
321
322
  }
322
- }, Gt = (e) => {
323
+ }, Ht = (e) => {
323
324
  N !== void 0 && window.clearTimeout(N), se(e), N = window.setTimeout(() => {
324
- if (N = void 0, Ne(D) !== e) return;
325
+ if (N = void 0, Ne(S) !== e) return;
325
326
  se("");
326
- const t = ee(e, Ne(E));
327
+ const t = ee(e, Ne(Y));
327
328
  if (t.kind === "ready") {
328
329
  ve(t.match);
329
330
  return;
330
331
  }
331
332
  t.kind === "pending" && t.exactMatch && ve(t.exactMatch);
332
- }, Lo);
333
+ }, Yo);
333
334
  }, lt = (e) => {
334
- const t = ee(e, E());
335
- return t.kind === "invalid" ? !1 : t.kind === "ready" ? (w(), ve(t.match), !0) : (Gt(e), !0);
336
- }, Ut = (e) => {
337
- const t = D(), o = `${t}${e}`;
335
+ const t = ee(e, Y());
336
+ return t.kind === "invalid" ? !1 : t.kind === "ready" ? (w(), ve(t.match), !0) : (Ht(e), !0);
337
+ }, Gt = (e) => {
338
+ const t = S(), o = `${t}${e}`;
338
339
  if (!lt(t ? o : e)) {
339
340
  if (!t || e === "0") {
340
341
  w();
@@ -342,10 +343,10 @@ function jo(r) {
342
343
  }
343
344
  lt(e) || w();
344
345
  }
345
- }, Kt = (e) => {
346
+ }, Ut = (e) => {
346
347
  T(e);
347
348
  }, Te = (e) => {
348
- const t = Yt(e);
349
+ const t = Lt(e);
349
350
  T(e), Promise.resolve(r.controller.bringNoteToFront(e)).then(() => {
350
351
  He(e, t) && ue(e);
351
352
  }).catch((o) => {
@@ -358,12 +359,12 @@ function jo(r) {
358
359
  }
359
360
  });
360
361
  }, Zt = (e) => {
361
- w(), u(null), S(e);
362
- }, Qt = async (e) => {
362
+ w(), u(null), D(e);
363
+ }, Kt = async (e) => {
363
364
  w();
364
365
  const t = mt(e.body);
365
366
  if (!t) {
366
- u(null), S(e.note_id);
367
+ u(null), D(e.note_id);
367
368
  return;
368
369
  }
369
370
  try {
@@ -377,54 +378,54 @@ function jo(r) {
377
378
  } catch (t) {
378
379
  s.error("Delete failed", h(t));
379
380
  }
380
- }, Jt = async (e) => {
381
+ }, Qt = async (e) => {
381
382
  try {
382
- H(e), await r.controller.restoreNote(e);
383
+ q(e), await r.controller.restoreNote(e);
383
384
  } catch (t) {
384
385
  s.error("Restore failed", h(t));
385
386
  }
386
- }, eo = async (e) => {
387
+ }, Jt = async (e) => {
387
388
  if (r.controller.deleteTrashedNotePermanently)
388
389
  try {
389
- H(e), await r.controller.deleteTrashedNotePermanently(e);
390
+ q(e), await r.controller.deleteTrashedNotePermanently(e);
390
391
  } catch (t) {
391
392
  s.error("Delete failed", h(t));
392
393
  }
393
- }, to = async (e) => {
394
+ }, eo = async (e) => {
394
395
  try {
395
396
  await r.controller.clearTrashTopic(e);
396
397
  } catch (t) {
397
398
  s.error("Trash failed", h(t));
398
399
  }
399
- }, oo = async () => {
400
- const e = V();
400
+ }, to = async () => {
401
+ const e = B();
401
402
  if (e)
402
403
  try {
403
404
  await r.controller.updateNote(e, {
404
405
  headline: ne(),
405
406
  title: ne(),
406
- body: De(),
407
+ body: Se(),
407
408
  color_token: Oe()
408
- }), s.success("Saved", "Note updated."), U();
409
+ }), s.success("Saved", "Note updated."), G();
409
410
  } catch (t) {
410
411
  s.error("Save failed", h(t));
411
412
  }
413
+ }, oo = async () => {
414
+ const e = V();
415
+ !e || !ie().trim() || (await it(e, ie()), H());
412
416
  }, no = async () => {
413
- const e = j();
414
- !e || !ie().trim() || (await it(e, ie()), G());
415
- }, ro = async () => {
416
417
  const e = Me().trim();
417
418
  if (e)
418
419
  try {
419
420
  const t = await r.controller.createTopic({ name: e });
420
- _e(""), Q(t.topic_id);
421
+ _e(""), K(t.topic_id);
421
422
  } catch (t) {
422
423
  s.error("Topic failed", h(t));
423
424
  }
424
- }, io = (e) => {
425
+ }, ro = (e) => {
425
426
  Pe(e.topic_id), oe(e.name);
426
- }, co = async () => {
427
- const e = B();
427
+ }, io = async () => {
428
+ const e = A();
428
429
  if (!e) return;
429
430
  const t = Ie().trim();
430
431
  if (Z(), !!t)
@@ -433,11 +434,11 @@ function jo(r) {
433
434
  } catch (o) {
434
435
  s.error("Rename failed", h(o));
435
436
  }
436
- }, so = async (e) => {
437
- const t = Ze(e.topic_id) + _o(d().trash_items, e.topic_id);
438
- B() === e.topic_id && Z();
437
+ }, co = async (e) => {
438
+ const t = Ke(e.topic_id) + Mo(d().trash_items, e.topic_id);
439
+ A() === e.topic_id && Z();
439
440
  try {
440
- if (zt(e.topic_id), await r.controller.deleteTopic(e.topic_id) === !1) {
441
+ if (Et(e.topic_id), await r.controller.deleteTopic(e.topic_id) === !1) {
441
442
  s.info("Keep one topic", "At least one topic needs to remain available.");
442
443
  return;
443
444
  }
@@ -449,7 +450,7 @@ function jo(r) {
449
450
  } catch (o) {
450
451
  s.error("Delete failed", h(o));
451
452
  }
452
- }, ao = async (e, t) => {
453
+ }, so = async (e, t) => {
453
454
  const o = Rt(e);
454
455
  Ue(e, t);
455
456
  try {
@@ -458,7 +459,7 @@ function jo(r) {
458
459
  y: t.y
459
460
  });
460
461
  } catch (n) {
461
- if (!Ge(e, o) || (pe(e), H(e), !de(e))) return;
462
+ if (!Ge(e, o) || (pe(e), q(e), !de(e))) return;
462
463
  s.error("Move failed", h(n));
463
464
  return;
464
465
  }
@@ -499,7 +500,7 @@ function jo(r) {
499
500
  o?.noteID && (u(null), dt(o.noteID));
500
501
  }
501
502
  })), t;
502
- }), lo = c(() => {
503
+ }), ao = c(() => {
503
504
  const e = v();
504
505
  if (!e) return;
505
506
  const t = ge().filter((n) => n.kind === "action").length, o = ge().filter((n) => n.kind === "separator").length;
@@ -509,7 +510,7 @@ function jo(r) {
509
510
  menuWidth: yo,
510
511
  menuHeight: No(t, o)
511
512
  });
512
- }), uo = (e) => {
513
+ }), lo = (e) => {
513
514
  const t = X();
514
515
  t && u({
515
516
  clientX: e.clientX,
@@ -518,15 +519,15 @@ function jo(r) {
518
519
  worldY: e.worldY,
519
520
  topicID: t.topic_id
520
521
  });
521
- }, po = (e, t) => {
522
+ }, uo = (e, t) => {
522
523
  Te(t.note_id), Je(e.clientX, e.clientY, {
523
524
  topicID: t.topic_id,
524
525
  noteID: t.note_id
525
526
  });
527
+ }, po = (e) => {
528
+ U(), Je(e.clientX, e.clientY);
526
529
  }, fo = (e) => {
527
- K(), Je(e.clientX, e.clientY);
528
- }, mo = (e) => {
529
- e.preventDefault(), e.stopPropagation(), qt(e.clientX, e.clientY);
530
+ e.preventDefault(), e.stopPropagation(), Wt(e.clientX, e.clientY);
530
531
  };
531
532
  p(() => {
532
533
  const e = new Set(d().items.map((t) => t.note_id));
@@ -539,27 +540,27 @@ function jo(r) {
539
540
  }), p(() => {
540
541
  r.open || (te = /* @__PURE__ */ new Set());
541
542
  });
542
- const ho = async () => {
543
+ const mo = async () => {
543
544
  const e = Qe();
544
- e && (Y(), await rt(e));
545
- }, wo = async () => {
545
+ e && (R(), await rt(e));
546
+ }, ho = async () => {
546
547
  const e = Qe();
547
- e && (Y(), await st(e));
548
+ e && (R(), await st(e));
548
549
  };
549
550
  return p(() => {
550
- r.open || (Bt(), Z(), k(null), T(null), C(null));
551
+ r.open || (At(), Z(), k(null), T(null), C(null));
551
552
  }), p(() => {
552
553
  const e = b();
553
- e && r.controller.activeTopicID() !== e && Q(e);
554
+ e && r.controller.activeTopicID() !== e && K(e);
554
555
  }), p(() => {
555
556
  const e = $e();
556
557
  if (!e) {
557
558
  le = null;
558
559
  return;
559
560
  }
560
- le !== e.note_id && (le = e.note_id, Se(e.title), ke(e.body), Xe(e.color_token));
561
+ le !== e.note_id && (le = e.note_id, De(e.title), ke(e.body), Xe(e.color_token));
561
562
  }), p(() => {
562
- const e = ze();
563
+ const e = Fe();
563
564
  if (!e) return;
564
565
  const t = d().items.find((n) => n.note_id === e);
565
566
  if (!t) {
@@ -574,25 +575,19 @@ function jo(r) {
574
575
  }), p(() => {
575
576
  r.open || (L(), w(), C(null));
576
577
  }), p(() => {
577
- D() && We() && w();
578
+ S() && We() && w();
578
579
  }), p(() => {
579
- const e = D();
580
- e && ee(e, E()).kind === "invalid" && w();
580
+ const e = S();
581
+ e && ee(e, Y()).kind === "invalid" && w();
581
582
  }), p(() => {
582
583
  const e = d().items, t = Be();
583
584
  if (t.size === 0) return;
584
585
  let o = null;
585
586
  for (const [n, i] of t) {
586
- const l = e.find((f) => f.note_id === n);
587
- (!l || xe({ x: l.x, y: l.y }, i)) && (o ??= new Map(t), o.delete(n));
587
+ const a = e.find((f) => f.note_id === n);
588
+ (!a || xe({ x: a.x, y: a.y }, i)) && (o ??= new Map(t), o.delete(n));
588
589
  }
589
- o && $(o);
590
- }), p(() => {
591
- if (!r.open) return;
592
- const e = () => {
593
- xt(window.innerWidth < Mo);
594
- };
595
- e(), window.addEventListener("resize", e), z(() => window.removeEventListener("resize", e));
590
+ o && j(o);
596
591
  }), p(() => {
597
592
  const e = Ce();
598
593
  if (!e) return;
@@ -603,126 +598,126 @@ function jo(r) {
603
598
  });
604
599
  };
605
600
  if (t(), typeof ResizeObserver > "u") {
606
- window.addEventListener("resize", t), z(() => window.removeEventListener("resize", t));
601
+ window.addEventListener("resize", t), Q(() => window.removeEventListener("resize", t));
607
602
  return;
608
603
  }
609
604
  const o = new ResizeObserver(t);
610
- o.observe(e), z(() => o.disconnect());
605
+ o.observe(e), Q(() => o.disconnect());
611
606
  }), p(() => {
612
607
  if (!r.open) return;
613
608
  const e = window.setInterval(() => yt(Date.now()), 60 * 1e3);
614
- z(() => window.clearInterval(e));
609
+ Q(() => window.clearInterval(e));
615
610
  }), p(() => {
616
611
  b() && u(null);
617
- }), z(() => {
612
+ }), Q(() => {
618
613
  L(), w(), we(!1);
619
614
  }), {
620
615
  header: {
621
- topicCount: Ct,
622
- totalLiveNotes: It,
616
+ topicCount: bt,
617
+ totalLiveNotes: Pt,
623
618
  trashCount: Ve
624
619
  },
625
620
  rail: {
626
621
  topics: x,
627
622
  activeTopicID: b,
628
623
  draftTopicTitle: Me,
629
- renamingTopicID: B,
624
+ renamingTopicID: A,
630
625
  renamingTopicTitle: Ie,
631
- getLiveNoteCount: Ze,
626
+ getLiveNoteCount: Ke,
632
627
  setDraftTopicTitle: _e,
633
- submitTopic: ro,
634
- selectTopic: Q,
635
- startTopicRename: io,
628
+ submitTopic: no,
629
+ selectTopic: K,
630
+ startTopicRename: ro,
636
631
  setRenamingTopicTitle: oe,
637
- saveTopicRename: co,
632
+ saveTopicRename: io,
638
633
  cancelTopicRename: Z,
639
- deleteTopic: so
634
+ deleteTopic: co
640
635
  },
641
636
  board: {
642
637
  activeTopic: X,
643
638
  activeTopicLabel: Dt,
644
- activeItems: W,
639
+ activeItems: $,
645
640
  activeTopicID: b,
646
641
  topics: x,
647
- topZIndex: St,
642
+ topZIndex: It,
648
643
  viewport: g,
649
- boardScaleLabel: kt,
644
+ boardScaleLabel: St,
650
645
  isMobile: Nt,
651
646
  overviewOpen: Le,
652
- optimisticFrontNoteID: ze,
647
+ optimisticFrontNoteID: Fe,
653
648
  copiedNoteID: Tt,
654
- noteNumberByID: _t,
655
- pendingShortcutNoteID: Lt,
649
+ noteNumberByID: Mt,
650
+ pendingShortcutNoteID: Yt,
656
651
  setCanvasFrameRef: wt,
657
652
  commitViewport: et,
658
- openCanvasContextMenu: uo,
653
+ openCanvasContextMenu: lo,
659
654
  zoomOut: () => ot("out"),
660
655
  zoomIn: () => ot("in"),
661
- openOverview: Ke,
662
- selectTopic: Q,
663
- mobileCreateNote: ho,
664
- mobilePaste: wo,
656
+ openOverview: Ze,
657
+ selectTopic: K,
658
+ mobileCreateNote: mo,
659
+ mobilePaste: ho,
665
660
  seedMoveProjection: Ue,
666
- copyNote: Qt,
667
- openNoteContextMenu: po,
661
+ copyNote: Kt,
662
+ openNoteContextMenu: uo,
668
663
  openEditor: Zt,
669
664
  moveToTrash: dt,
670
- startOptimisticFront: Kt,
665
+ startOptimisticFront: Ut,
671
666
  commitFront: Te,
672
- commitMove: ao
667
+ commitMove: so
673
668
  },
674
669
  overview: {
675
- items: Xt,
676
- viewportStyle: Et,
677
- navigationState: bt,
678
- beginNavigation: Ht,
679
- close: Y,
680
- open: Ke
670
+ items: Ot,
671
+ viewportStyle: Xt,
672
+ navigationState: xt,
673
+ beginNavigation: qt,
674
+ close: R,
675
+ open: Ze
681
676
  },
682
677
  trash: {
683
678
  open: re,
684
- groups: Pt,
679
+ groups: _t,
685
680
  count: Ve,
686
681
  now: gt,
687
682
  canDeleteNow: !!r.controller.deleteTrashedNotePermanently,
688
- close: K,
683
+ close: U,
689
684
  openDock: me,
690
- backdropContextMenu: fo,
691
- restore: Jt,
692
- deleteNow: eo,
693
- clearTopic: to
685
+ backdropContextMenu: po,
686
+ restore: Qt,
687
+ deleteNow: Jt,
688
+ clearTopic: eo
694
689
  },
695
690
  contextMenu: {
696
691
  state: v,
697
692
  items: ge,
698
- position: lo,
693
+ position: ao,
699
694
  close: () => u(null),
700
- retarget: mo
695
+ retarget: fo
701
696
  },
702
697
  editor: {
703
698
  note: $e,
704
699
  draftTitle: ne,
705
- draftBody: De,
700
+ draftBody: Se,
706
701
  draftColor: Oe,
707
- setDraftTitle: Se,
702
+ setDraftTitle: De,
708
703
  setDraftBody: ke,
709
704
  setDraftColor: Xe,
710
- close: U,
711
- save: oo
705
+ close: G,
706
+ save: to
712
707
  },
713
708
  manualPaste: {
714
- open: () => !!j(),
709
+ open: () => !!V(),
715
710
  text: ie,
716
711
  setText: ce,
717
- close: G,
718
- confirm: no
712
+ close: H,
713
+ confirm: oo
719
714
  },
720
715
  shortcuts: {
721
716
  blocked: We,
722
- handleDigitShortcut: Ut,
717
+ handleDigitShortcut: Gt,
723
718
  clearPendingDigitState: w
724
719
  },
725
- handleCloseRequest: Vt
720
+ handleCloseRequest: Bt
726
721
  };
727
722
  }
728
723
  export {