@parallelworks/tandem-web 0.189.4 → 0.189.5

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.
@@ -11,16 +11,16 @@ import { SeriesMenu as h } from "./DocSeries.js";
11
11
  import { Board as g, groupable as _ } from "./DocTable.js";
12
12
  import { iconImageURL as v } from "./EntityIcon.js";
13
13
  import { AddIcon as y, ArticleIcon as b, BoardIcon as x, CalendarIcon as S, ChevronRightIcon as C, CycleIcon as ee, GridIcon as w, ListViewIcon as T, SettingsIcon as E, SpreadsheetIcon as D, TimelineIcon as O } from "./icons.js";
14
- import { Button as k, ErrorText as A, Input as te, Popover as j, Select as M, cx as N, useOpenMenu as P } from "@parallelworks/ui";
14
+ import { Button as k, ErrorText as A, Input as j, Popover as M, Select as N, cx as P, useOpenMenu as te } from "@parallelworks/ui";
15
15
  import { Link as F, useNavigate as ne } from "@tanstack/react-router";
16
- import { useMemo as I, useRef as re, useState as ie } from "react";
17
- import { useErrorMessage as L } from "@parallelworks/problem/react";
18
- import { useFormatter as R, useLocale as ae, useTranslations as z } from "use-intl";
19
- import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
20
- import { keepPreviousData as oe, useQuery as U } from "@tanstack/react-query";
16
+ import { useLayoutEffect as I, useMemo as L, useRef as re, useState as ie } from "react";
17
+ import { useErrorMessage as R } from "@parallelworks/problem/react";
18
+ import { useFormatter as z, useLocale as ae, useTranslations as B } from "use-intl";
19
+ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
20
+ import { keepPreviousData as oe, useQuery as W } from "@tanstack/react-query";
21
21
  import { useVirtualizer as se } from "@tanstack/react-virtual";
22
22
  // src/components/SubpageViews.tsx
23
- var W = [
23
+ var G = [
24
24
  {
25
25
  layout: "table",
26
26
  icon: D,
@@ -63,55 +63,55 @@ var W = [
63
63
  message: "feed",
64
64
  database: !1
65
65
  }
66
- ], G = (e) => W.find((t) => t.layout === e) ?? W[4], K = (e) => e === "calendar" || e === "timeline", q = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
67
- function ce(e) {
66
+ ], K = (e) => G.find((t) => t.layout === e) ?? G[4], ce = (e) => e === "calendar" || e === "timeline", q = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
67
+ function le(e) {
68
68
  let t = new Intl.Locale(e);
69
69
  return (t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 7) % 7;
70
70
  }
71
- function le({ workspace: e, doc: t, space: n }) {
72
- let r = z("subpages"), { data: i = [] } = U(d(e, t.key)), [a, o] = ie(), s = l(e, "edit_docs", n === "workspace" ? void 0 : { team: n }), c = f(e);
71
+ function J({ workspace: e, doc: t, space: n }) {
72
+ let r = B("subpages"), { data: i = [] } = W(d(e, t.key)), [a, o] = ie(), s = l(e, "edit_docs", n === "workspace" ? void 0 : { team: n }), c = f(e);
73
73
  if (i.length === 0) return null;
74
74
  let p = i.find((e) => e.id === a) ?? i[0], m = (e) => c.addView.mutate({
75
75
  doc: t.key,
76
- name: r(G(e).message),
76
+ name: r(K(e).message),
77
77
  layout: e,
78
78
  config: { ...u(p.config) }
79
79
  }, { onSuccess: (e) => o(e.id) });
80
- return /* @__PURE__ */ H("section", {
80
+ return /* @__PURE__ */ U("section", {
81
81
  className: "not-prose my-4",
82
82
  "aria-label": r("views"),
83
- children: [/* @__PURE__ */ H("div", {
83
+ children: [/* @__PURE__ */ U("div", {
84
84
  className: "flex items-center gap-1 border-b border-border",
85
85
  children: [i.map((e) => {
86
- let t = G(e.layout).icon;
87
- return /* @__PURE__ */ H("button", {
86
+ let t = K(e.layout).icon;
87
+ return /* @__PURE__ */ U("button", {
88
88
  type: "button",
89
89
  onClick: () => o(e.id),
90
90
  "aria-pressed": e.id === p.id,
91
- className: N("-mb-px flex items-center gap-1.5 border-b-2 px-2 py-1.5 text-sm", e.id === p.id ? "border-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"),
92
- children: [/* @__PURE__ */ V(t, { className: "size-4" }), e.name]
91
+ className: P("-mb-px flex items-center gap-1.5 border-b-2 px-2 py-1.5 text-sm", e.id === p.id ? "border-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"),
92
+ children: [/* @__PURE__ */ H(t, { className: "size-4" }), e.name]
93
93
  }, e.id);
94
- }), s && /* @__PURE__ */ V(j, {
95
- trigger: /* @__PURE__ */ V(k, {
94
+ }), s && /* @__PURE__ */ H(M, {
95
+ trigger: /* @__PURE__ */ H(k, {
96
96
  size: "xs",
97
97
  variant: "ghost",
98
98
  "aria-label": r("addView"),
99
- children: /* @__PURE__ */ V(y, {})
99
+ children: /* @__PURE__ */ H(y, {})
100
100
  }),
101
101
  align: "start",
102
102
  "aria-label": r("addView"),
103
- children: /* @__PURE__ */ V("div", {
103
+ children: /* @__PURE__ */ H("div", {
104
104
  className: "flex flex-col gap-1",
105
- children: W.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ H(k, {
105
+ children: G.map(({ layout: e, icon: t, message: n }) => /* @__PURE__ */ U(k, {
106
106
  size: "sm",
107
107
  variant: "ghost",
108
108
  className: "justify-start",
109
109
  onClick: () => m(e),
110
- children: [/* @__PURE__ */ V(t, {}), r(n)]
110
+ children: [/* @__PURE__ */ H(t, {}), r(n)]
111
111
  }, e))
112
112
  })
113
113
  })]
114
- }), /* @__PURE__ */ V(ue, {
114
+ }), /* @__PURE__ */ H(Y, {
115
115
  workspace: e,
116
116
  doc: t,
117
117
  space: n,
@@ -120,11 +120,11 @@ function le({ workspace: e, doc: t, space: n }) {
120
120
  }, p.id)]
121
121
  });
122
122
  }
123
- function ue({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
124
- let d = z("subpages"), m = L(), v = ne(), b = u(s.config), { data: x = [] } = U(t(e, { parent: a.key })), { data: S = [] } = U(i(e, o)), C = S.find((e) => e.id === b.dateProperty && e.kind === "date"), ee = S.find((e) => e.id === b.groupBy && _(e)), [w, T] = ie(""), E = f(e), D = w.trim().toLowerCase(), O = D ? x.filter((e) => e.title.toLowerCase().includes(D)) : x, M = (e) => {
123
+ function Y({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
124
+ let d = B("subpages"), m = R(), v = ne(), b = u(s.config), { data: x = [] } = W(t(e, { parent: a.key })), { data: S = [] } = W(i(e, o)), C = S.find((e) => e.id === b.dateProperty && e.kind === "date"), ee = S.find((e) => e.id === b.groupBy && _(e)), [w, T] = ie(""), E = f(e), D = w.trim().toLowerCase(), O = D ? x.filter((e) => e.title.toLowerCase().includes(D)) : x, N = (e) => {
125
125
  let t = C && e.properties?.[C.id];
126
126
  return typeof t == "string" && n(t) ? t : void 0;
127
- }, N = O.filter((e) => !M(e)), P = (t, n) => E.newSubpage.mutate({
127
+ }, P = O.filter((e) => !N(e)), te = (t, n) => E.newSubpage.mutate({
128
128
  parent: a,
129
129
  title: t ? d("titleOn", {
130
130
  title: a.title,
@@ -139,36 +139,36 @@ function ue({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
139
139
  workspace: e,
140
140
  doc: c(t)
141
141
  }
142
- }) }), I = /* @__PURE__ */ H(B, { children: [
143
- C && K(s.layout) && /* @__PURE__ */ V(j, {
144
- trigger: /* @__PURE__ */ V(k, {
142
+ }) }), I = /* @__PURE__ */ U(V, { children: [
143
+ C && ce(s.layout) && /* @__PURE__ */ H(M, {
144
+ trigger: /* @__PURE__ */ H(k, {
145
145
  size: "xs",
146
146
  variant: "ghost",
147
- children: d("noDate", { count: N.length })
147
+ children: d("noDate", { count: P.length })
148
148
  }),
149
149
  align: "start",
150
150
  className: "max-h-80 w-72 overflow-y-auto",
151
151
  "aria-label": d("noDateTitle"),
152
- children: N.length === 0 ? /* @__PURE__ */ V("p", {
152
+ children: P.length === 0 ? /* @__PURE__ */ H("p", {
153
153
  className: "text-sm text-muted-foreground",
154
154
  children: d("allDated")
155
- }) : /* @__PURE__ */ V("ul", {
155
+ }) : /* @__PURE__ */ H("ul", {
156
156
  className: "space-y-1",
157
- children: N.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
157
+ children: P.map((t) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
158
158
  to: "/$workspace/docs/$doc",
159
159
  params: {
160
160
  workspace: e,
161
161
  doc: c(t)
162
162
  },
163
163
  className: "flex items-center gap-1.5 truncate text-sm hover:underline",
164
- children: [/* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
164
+ children: [/* @__PURE__ */ H(p, { icon: t.icon }), /* @__PURE__ */ H("span", {
165
165
  className: "truncate",
166
166
  children: t.title
167
167
  })]
168
168
  }) }, t.id))
169
169
  })
170
170
  }),
171
- /* @__PURE__ */ V(te, {
171
+ /* @__PURE__ */ H(j, {
172
172
  type: "search",
173
173
  size: "sm",
174
174
  value: w,
@@ -177,14 +177,14 @@ function ue({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
177
177
  "aria-label": d("search"),
178
178
  className: "w-40"
179
179
  }),
180
- l && /* @__PURE__ */ H(B, { children: [
181
- /* @__PURE__ */ V(J, {
180
+ l && /* @__PURE__ */ U(V, { children: [
181
+ /* @__PURE__ */ H(ue, {
182
182
  workspace: e,
183
183
  space: o,
184
184
  view: s,
185
185
  config: b
186
186
  }),
187
- C && /* @__PURE__ */ V(h, {
187
+ C && /* @__PURE__ */ H(h, {
188
188
  workspace: e,
189
189
  space: o,
190
190
  dateProperty: C.id,
@@ -193,70 +193,70 @@ function ue({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
193
193
  key: a.key
194
194
  }
195
195
  }),
196
- /* @__PURE__ */ H(k, {
196
+ /* @__PURE__ */ U(k, {
197
197
  size: "xs",
198
198
  variant: "primary",
199
199
  loading: E.newSubpage.isPending,
200
- onClick: () => P(C ? r(/* @__PURE__ */ new Date()) : void 0),
201
- children: [/* @__PURE__ */ V(y, {}), d("new")]
200
+ onClick: () => te(C ? r(/* @__PURE__ */ new Date()) : void 0),
201
+ children: [/* @__PURE__ */ H(y, {}), d("new")]
202
202
  })
203
203
  ] })
204
204
  ] });
205
- return /* @__PURE__ */ H("div", {
205
+ return /* @__PURE__ */ U("div", {
206
206
  className: "pt-2",
207
- children: [E.newSubpage.error && /* @__PURE__ */ V(A, { children: m(E.newSubpage.error) }), s.layout === "feed" ? /* @__PURE__ */ V(Q, {
207
+ children: [E.newSubpage.error && /* @__PURE__ */ H(A, { children: m(E.newSubpage.error) }), s.layout === "feed" ? /* @__PURE__ */ H(he, {
208
208
  workspace: e,
209
209
  docs: O,
210
- dateOf: M,
210
+ dateOf: N,
211
211
  toolbar: I
212
- }) : s.layout === "table" ? /* @__PURE__ */ V(he, {
212
+ }) : s.layout === "table" ? /* @__PURE__ */ H(_e, {
213
213
  workspace: e,
214
214
  docs: O,
215
215
  props: S,
216
216
  toolbar: I
217
- }) : s.layout === "list" ? /* @__PURE__ */ V(ge, {
217
+ }) : s.layout === "list" ? /* @__PURE__ */ H(ve, {
218
218
  workspace: e,
219
219
  docs: O,
220
220
  toolbar: I
221
- }) : s.layout === "gallery" ? /* @__PURE__ */ V(_e, {
221
+ }) : s.layout === "gallery" ? /* @__PURE__ */ H(ye, {
222
222
  workspace: e,
223
223
  docs: O,
224
224
  toolbar: I
225
- }) : s.layout === "board" ? ee ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
225
+ }) : s.layout === "board" ? ee ? /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
226
226
  className: "flex flex-wrap items-center gap-1 py-2",
227
227
  children: I
228
- }), /* @__PURE__ */ V(g, {
228
+ }), /* @__PURE__ */ H(g, {
229
229
  workspace: e,
230
230
  space: o,
231
231
  docs: O,
232
232
  props: S,
233
233
  by: ee
234
- })] }) : /* @__PURE__ */ H("div", {
234
+ })] }) : /* @__PURE__ */ U("div", {
235
235
  className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
236
- children: [d("pickGroup"), l && /* @__PURE__ */ V(J, {
236
+ children: [d("pickGroup"), l && /* @__PURE__ */ H(ue, {
237
237
  workspace: e,
238
238
  space: o,
239
239
  view: s,
240
240
  config: b,
241
241
  open: !0
242
242
  })]
243
- }) : C ? s.layout === "timeline" ? /* @__PURE__ */ V(ve, {
243
+ }) : C ? s.layout === "timeline" ? /* @__PURE__ */ H(be, {
244
244
  workspace: e,
245
245
  docs: O,
246
- dateOf: M,
246
+ dateOf: N,
247
247
  toolbar: I
248
- }) : /* @__PURE__ */ V(pe, {
248
+ }) : /* @__PURE__ */ H(Q, {
249
249
  workspace: e,
250
250
  docs: O,
251
- dateOf: M,
251
+ dateOf: N,
252
252
  toolbar: I,
253
253
  parent: a,
254
254
  space: o,
255
255
  viewTemplate: b.template,
256
- onNew: l ? (e, t) => P(e, t) : void 0
257
- }) : /* @__PURE__ */ H("div", {
256
+ onNew: l ? (e, t) => te(e, t) : void 0
257
+ }) : /* @__PURE__ */ U("div", {
258
258
  className: "flex flex-wrap items-center gap-2 py-3 text-sm text-muted-foreground",
259
- children: [s.layout === "timeline" ? d("pickTimelineDate") : d("pickDate"), l && /* @__PURE__ */ V(J, {
259
+ children: [s.layout === "timeline" ? d("pickTimelineDate") : d("pickDate"), l && /* @__PURE__ */ H(ue, {
260
260
  workspace: e,
261
261
  space: o,
262
262
  view: s,
@@ -266,32 +266,32 @@ function ue({ workspace: e, doc: a, space: o, view: s, canWrite: l }) {
266
266
  })]
267
267
  });
268
268
  }
269
- function J({ workspace: t, space: n, view: r, config: o, open: s }) {
270
- let c = z("subpages"), l = L(), u = f(t), d = a(t), { data: p = [] } = U(i(t, n)), { data: m = [] } = U(e(t)), h = p.filter((e) => e.kind === "date"), g = p.filter(_), v = (e) => u.updateView.mutate({
269
+ function ue({ workspace: t, space: n, view: r, config: o, open: s }) {
270
+ let c = B("subpages"), l = R(), u = f(t), d = a(t), { data: p = [] } = W(i(t, n)), { data: m = [] } = W(e(t)), h = p.filter((e) => e.kind === "date"), g = p.filter(_), v = (e) => u.updateView.mutate({
271
271
  view: r,
272
272
  config: { ...e }
273
273
  }), y = "block text-xs font-medium text-muted-foreground";
274
- return /* @__PURE__ */ V(j, {
275
- trigger: s ? /* @__PURE__ */ V(k, {
274
+ return /* @__PURE__ */ H(M, {
275
+ trigger: s ? /* @__PURE__ */ H(k, {
276
276
  size: "xs",
277
277
  children: c("settings")
278
- }) : /* @__PURE__ */ V(k, {
278
+ }) : /* @__PURE__ */ H(k, {
279
279
  size: "xs",
280
280
  variant: "ghost",
281
281
  "aria-label": c("settings"),
282
- children: /* @__PURE__ */ V(E, {})
282
+ children: /* @__PURE__ */ H(E, {})
283
283
  }),
284
284
  align: "end",
285
285
  className: "w-72",
286
286
  "aria-label": c("settings"),
287
- children: /* @__PURE__ */ H("div", {
287
+ children: /* @__PURE__ */ U("div", {
288
288
  className: "space-y-3",
289
289
  children: [
290
- r.layout === "board" && /* @__PURE__ */ H("div", {
290
+ r.layout === "board" && /* @__PURE__ */ U("div", {
291
291
  className: y,
292
- children: [c("groupBy"), /* @__PURE__ */ H("div", {
292
+ children: [c("groupBy"), /* @__PURE__ */ U("div", {
293
293
  className: "mt-1 flex items-center gap-2",
294
- children: [g.length > 0 && /* @__PURE__ */ V(M, {
294
+ children: [g.length > 0 && /* @__PURE__ */ H(N, {
295
295
  value: o.groupBy ?? "",
296
296
  items: [{
297
297
  value: "",
@@ -306,7 +306,7 @@ function J({ workspace: t, space: n, view: r, config: o, open: s }) {
306
306
  }),
307
307
  "aria-label": c("groupBy"),
308
308
  size: "sm"
309
- }), /* @__PURE__ */ V(k, {
309
+ }), /* @__PURE__ */ H(k, {
310
310
  size: "xs",
311
311
  loading: d.create.isPending,
312
312
  onClick: async () => {
@@ -329,11 +329,11 @@ function J({ workspace: t, space: n, view: r, config: o, open: s }) {
329
329
  })]
330
330
  })]
331
331
  }),
332
- (K(r.layout) || r.layout === "feed") && /* @__PURE__ */ H("div", {
332
+ (ce(r.layout) || r.layout === "feed") && /* @__PURE__ */ U("div", {
333
333
  className: y,
334
- children: [c("dateProperty"), /* @__PURE__ */ H("div", {
334
+ children: [c("dateProperty"), /* @__PURE__ */ U("div", {
335
335
  className: "mt-1 flex items-center gap-2",
336
- children: [h.length > 0 && /* @__PURE__ */ V(M, {
336
+ children: [h.length > 0 && /* @__PURE__ */ H(N, {
337
337
  value: o.dateProperty ?? "",
338
338
  items: [{
339
339
  value: "",
@@ -348,7 +348,7 @@ function J({ workspace: t, space: n, view: r, config: o, open: s }) {
348
348
  }),
349
349
  "aria-label": c("dateProperty"),
350
350
  size: "sm"
351
- }), /* @__PURE__ */ V(k, {
351
+ }), /* @__PURE__ */ H(k, {
352
352
  size: "xs",
353
353
  loading: d.create.isPending,
354
354
  onClick: async () => {
@@ -366,11 +366,11 @@ function J({ workspace: t, space: n, view: r, config: o, open: s }) {
366
366
  })]
367
367
  })]
368
368
  }),
369
- /* @__PURE__ */ H("div", {
369
+ /* @__PURE__ */ U("div", {
370
370
  className: y,
371
- children: [c("template"), /* @__PURE__ */ V("div", {
371
+ children: [c("template"), /* @__PURE__ */ H("div", {
372
372
  className: "mt-1",
373
- children: /* @__PURE__ */ V(M, {
373
+ children: /* @__PURE__ */ H(N, {
374
374
  value: o.template ?? "",
375
375
  items: [{
376
376
  value: "",
@@ -388,8 +388,8 @@ function J({ workspace: t, space: n, view: r, config: o, open: s }) {
388
388
  })
389
389
  })]
390
390
  }),
391
- (u.updateView.error ?? d.create.error) && /* @__PURE__ */ V(A, { children: l(u.updateView.error ?? d.create.error) }),
392
- /* @__PURE__ */ V(k, {
391
+ (u.updateView.error ?? d.create.error) && /* @__PURE__ */ H(A, { children: l(u.updateView.error ?? d.create.error) }),
392
+ /* @__PURE__ */ H(k, {
393
393
  size: "xs",
394
394
  variant: "danger",
395
395
  onClick: () => u.removeView.mutate(r),
@@ -399,53 +399,92 @@ function J({ workspace: t, space: n, view: r, config: o, open: s }) {
399
399
  })
400
400
  });
401
401
  }
402
- var Y = 128, de = 3, X = 32, Z = 5200, fe = (e, t) => Math.round((Date.UTC(t.getFullYear(), t.getMonth(), t.getDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / 864e5);
403
- function pe({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d, viewTemplate: f, onNew: m }) {
404
- let h = z("subpages"), g = R(), _ = ae(), v = ne(), b = P(), x = I(() => /* @__PURE__ */ new Date(), []), S = ce(_), w = I(() => q(x, -((x.getDay() - S + 7) % 7) - Z * 7), [x, S]), T = (e) => Math.floor(fe(w, e) / 7), E = (e) => q(w, e * 7), D = re(null), [O, A] = ie(() => new Date(x.getFullYear(), x.getMonth(), 1)), te = (e, t) => {
405
- let n = Math.max(0, Math.floor((e + t / 2 - X) / Y)), r = q(E(n), 3);
402
+ var X = 128, de = 3, Z = 32, fe = 26, pe = 8, me = (e, t) => Math.round((Date.UTC(t.getFullYear(), t.getMonth(), t.getDate()) - Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())) / 864e5);
403
+ function Q({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d, viewTemplate: f, onNew: m }) {
404
+ let h = B("subpages"), g = z(), _ = ae(), v = ne(), b = te(), x = L(() => /* @__PURE__ */ new Date(), []), S = le(_), w = L(() => q(x, -((x.getDay() - S + 7) % 7)), [x, S]), T = (e) => Math.floor(me(w, e) / 7), E = L(() => {
405
+ let e = x;
406
+ for (let t of i) {
407
+ let r = a(t), i = r && n(r);
408
+ i && i < e && (e = i);
409
+ }
410
+ return Math.floor(me(w, new Date(e.getFullYear(), e.getMonth(), 1)) / 7);
411
+ }, [
412
+ i,
413
+ a,
414
+ x,
415
+ w
416
+ ]), [D, O] = ie(() => ({
417
+ from: Math.max(E, -26),
418
+ to: fe
419
+ })), A = Math.max(E, Math.min(D.from, 0)), j = (e) => q(w, (A + e) * 7), N = (e) => T(e) - A, R = re(null), V = re(null), [G, K] = ie(() => new Date(x.getFullYear(), x.getMonth(), 1)), ce = (e, t) => {
420
+ let n = Math.max(0, Math.floor((e + t / 2 - Z) / X)), r = q(j(n), 3);
406
421
  return new Date(r.getFullYear(), r.getMonth(), 1);
407
- }, M = se({
408
- count: 10401,
409
- getScrollElement: () => D.current,
410
- estimateSize: () => Y,
422
+ }, J = se({
423
+ count: D.to - A + 1,
424
+ getScrollElement: () => R.current,
425
+ estimateSize: () => X,
426
+ getItemKey: (e) => A + e,
411
427
  overscan: 3,
412
- scrollMargin: X,
413
- initialOffset: 5199 * Y,
428
+ scrollMargin: Z,
429
+ initialOffset: (-A - 1) * X,
414
430
  onChange: (e) => {
415
- let t = te(e.scrollOffset ?? 0, e.scrollRect?.height ?? 0);
416
- A((e) => e.getTime() === t.getTime() ? e : t);
431
+ if (V.current) return;
432
+ let t = ce(e.scrollOffset ?? 0, e.scrollRect?.height ?? 0);
433
+ K((e) => e.getTime() === t.getTime() ? e : t);
434
+ let n = e.range;
435
+ if (n) {
436
+ if (n.startIndex < pe && A > E) {
437
+ let e = Math.max(E, A - fe);
438
+ V.current = { above: A - e }, O((t) => ({
439
+ ...t,
440
+ from: e
441
+ }));
442
+ } else n.endIndex > D.to - A - pe && O((e) => ({
443
+ ...e,
444
+ to: e.to + fe
445
+ }));
446
+ }
417
447
  }
418
- }), L = (e) => {
419
- A(e), M.scrollToIndex(T(e), { align: "start" });
420
- }, B = M.getVirtualItems(), W = E(B[0]?.index ?? Z), G = q(E(B[B.length - 1]?.index ?? Z), 6), { data: K = [] } = U({
421
- ...o(t, d, r(new Date(W.getFullYear(), W.getMonth(), 1)), r(new Date(G.getFullYear(), G.getMonth() + 1, 0))),
448
+ });
449
+ I(() => {
450
+ let e = V.current;
451
+ e && (V.current = null, "above" in e ? R.current?.scrollBy({ top: e.above * X }) : J.scrollToIndex(N(e.target), { align: "start" }));
452
+ });
453
+ let Y = (e) => {
454
+ let t = Math.max(T(e), E);
455
+ K(e), t >= A && t <= D.to ? J.scrollToIndex(t - A, { align: "start" }) : (V.current = { target: e }, O((e) => ({
456
+ from: Math.min(e.from, Math.max(E, t - pe)),
457
+ to: Math.max(e.to, t + fe)
458
+ })));
459
+ }, ue = T(G) <= E, Q = J.getVirtualItems(), he = j(Q[0]?.index ?? -A), ge = q(j(Q[Q.length - 1]?.index ?? -A), 6), { data: _e = [] } = W({
460
+ ...o(t, d, r(new Date(he.getFullYear(), he.getMonth(), 1)), r(new Date(ge.getFullYear(), ge.getMonth() + 1, 0))),
422
461
  placeholderData: oe
423
- }), le = s(t), { data: ue = [] } = U(e(t)), J = I(() => {
462
+ }), ve = s(t), { data: ye = [] } = W(e(t)), $ = L(() => {
424
463
  let e = /* @__PURE__ */ new Map();
425
464
  for (let t of i) {
426
465
  let n = a(t);
427
466
  n && e.set(n, [...e.get(n) ?? [], t]);
428
467
  }
429
468
  return e;
430
- }, [i, a]), pe = I(() => {
469
+ }, [i, a]), be = L(() => {
431
470
  let e = /* @__PURE__ */ new Map();
432
- for (let t of K) if (t.parentId === u.id && !t.stoppedAt) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
471
+ for (let t of _e) if (t.parentId === u.id && !t.stoppedAt) for (let n of t.upcoming ?? []) e.set(n, [...e.get(n) ?? [], t]);
433
472
  return e;
434
- }, [K, u.id]), Q = r(x), me = (e) => /* @__PURE__ */ H(F, {
473
+ }, [_e, u.id]), xe = r(x), Se = (e) => /* @__PURE__ */ U(F, {
435
474
  to: "/$workspace/docs/$doc",
436
475
  params: {
437
476
  workspace: t,
438
477
  doc: c(e)
439
478
  },
440
479
  className: "flex min-w-0 items-center gap-1 rounded bg-card px-1.5 py-0.5 text-xs shadow-xs ring-1 ring-border hover:bg-accent",
441
- children: [/* @__PURE__ */ V(p, { icon: e.icon }), /* @__PURE__ */ V("span", {
480
+ children: [/* @__PURE__ */ H(p, { icon: e.icon }), /* @__PURE__ */ H("span", {
442
481
  className: "truncate",
443
482
  children: e.title
444
483
  })]
445
- }, e.id), he = (e, n) => /* @__PURE__ */ H("button", {
484
+ }, e.id), Ce = (e, n) => /* @__PURE__ */ U("button", {
446
485
  type: "button",
447
- disabled: !m || le.makeDoc.isPending,
448
- onClick: () => le.makeDoc.mutate({
486
+ disabled: !m || ve.makeDoc.isPending,
487
+ onClick: () => ve.makeDoc.mutate({
449
488
  id: e.id,
450
489
  day: n
451
490
  }, { onSuccess: (e) => v({
@@ -457,14 +496,14 @@ function pe({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
457
496
  }) }),
458
497
  "aria-label": h("makeSeriesDoc", { series: e.title }),
459
498
  className: "flex min-w-0 items-center gap-1 rounded border border-dashed border-border px-1.5 py-0.5 text-left text-xs text-muted-foreground enabled:hover:border-primary enabled:hover:text-foreground",
460
- children: [/* @__PURE__ */ V(ee, { className: "size-3 shrink-0" }), /* @__PURE__ */ V("span", {
499
+ children: [/* @__PURE__ */ H(ee, { className: "size-3 shrink-0" }), /* @__PURE__ */ H("span", {
461
500
  className: "truncate",
462
501
  children: e.title
463
502
  })]
464
- }, `${e.id}-${n}`), ge = ue.filter((e) => e.starter || !e.teamId || e.teamId === u.teamId).sort((e, t) => Number(t.id === f) - Number(e.id === f)), _e = (e, t = !1) => m && /* @__PURE__ */ V("button", {
503
+ }, `${e.id}-${n}`), we = ye.filter((e) => e.starter || !e.teamId || e.teamId === u.teamId).sort((e, t) => Number(t.id === f) - Number(e.id === f)), Te = (e, t = !1) => m && /* @__PURE__ */ H("button", {
465
504
  type: "button",
466
505
  onClick: (t) => b(t, [
467
- ...ge.filter((e) => e.id === f).map((t) => ({
506
+ ...we.filter((e) => e.id === f).map((t) => ({
468
507
  label: h("fromTemplateDefault", { template: t.title }),
469
508
  onClick: () => m(e, t.id)
470
509
  })),
@@ -472,102 +511,103 @@ function pe({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
472
511
  label: h("emptyPage"),
473
512
  onClick: () => m(e, null)
474
513
  },
475
- ...ge.filter((e) => e.id !== f).map((t) => ({
514
+ ...we.filter((e) => e.id !== f).map((t) => ({
476
515
  label: t.title,
477
516
  onClick: () => m(e, t.id)
478
517
  }))
479
518
  ]),
480
519
  "aria-label": h("newOn", { date: g.dateTime(n(e), { dateStyle: "medium" }) }),
481
- className: N("rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100", !t && "opacity-0 group-hover:opacity-100"),
482
- children: /* @__PURE__ */ V(y, { className: "size-3.5" })
483
- }), $ = (e) => e.getDay() === 0 || e.getDay() === 6, ve = (e) => e.getMonth() === O.getMonth() && e.getFullYear() === O.getFullYear(), ye = (e) => [...(J.get(e) ?? []).map(me), ...(pe.get(e) ?? []).map((t) => he(t, e))], be = Array.from({ length: new Date(O.getFullYear(), O.getMonth() + 1, 0).getDate() }, (e, t) => new Date(O.getFullYear(), O.getMonth(), t + 1)).filter((e) => J.has(r(e)) || pe.has(r(e)) || r(e) === Q);
484
- return /* @__PURE__ */ H("div", {
520
+ className: P("rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:opacity-100", !t && "opacity-0 group-hover:opacity-100"),
521
+ children: /* @__PURE__ */ H(y, { className: "size-3.5" })
522
+ }), Ee = (e) => e.getDay() === 0 || e.getDay() === 6, De = (e) => e.getMonth() === G.getMonth() && e.getFullYear() === G.getFullYear(), Oe = (e) => [...($.get(e) ?? []).map(Se), ...(be.get(e) ?? []).map((t) => Ce(t, e))], ke = Array.from({ length: new Date(G.getFullYear(), G.getMonth() + 1, 0).getDate() }, (e, t) => new Date(G.getFullYear(), G.getMonth(), t + 1)).filter((e) => $.has(r(e)) || be.has(r(e)) || r(e) === xe);
523
+ return /* @__PURE__ */ U("div", {
485
524
  className: "flex flex-col",
486
525
  children: [
487
- /* @__PURE__ */ H("div", {
526
+ /* @__PURE__ */ U("div", {
488
527
  className: "flex flex-wrap items-center gap-2 py-2",
489
528
  children: [
490
- /* @__PURE__ */ H("h3", {
529
+ /* @__PURE__ */ U("h3", {
491
530
  className: "grid text-base font-semibold tabular-nums",
492
531
  "aria-live": "polite",
493
- children: [Array.from({ length: 12 }, (e, t) => g.dateTime(new Date(O.getFullYear(), t, 1), {
532
+ children: [Array.from({ length: 12 }, (e, t) => g.dateTime(new Date(G.getFullYear(), t, 1), {
494
533
  month: "long",
495
534
  year: "numeric"
496
- })).map((e) => /* @__PURE__ */ V("span", {
535
+ })).map((e) => /* @__PURE__ */ H("span", {
497
536
  "aria-hidden": !0,
498
537
  className: "invisible col-start-1 row-start-1",
499
538
  children: e
500
- }, e)), /* @__PURE__ */ V("span", {
539
+ }, e)), /* @__PURE__ */ H("span", {
501
540
  className: "col-start-1 row-start-1",
502
- children: g.dateTime(O, {
541
+ children: g.dateTime(G, {
503
542
  month: "long",
504
543
  year: "numeric"
505
544
  })
506
545
  })]
507
546
  }),
508
- /* @__PURE__ */ V("span", {
547
+ /* @__PURE__ */ H("span", {
509
548
  className: "flex flex-wrap items-center gap-1",
510
549
  children: l
511
550
  }),
512
- /* @__PURE__ */ H("span", {
551
+ /* @__PURE__ */ U("span", {
513
552
  className: "ml-auto flex items-center gap-1",
514
553
  children: [
515
- /* @__PURE__ */ V(k, {
554
+ /* @__PURE__ */ H(k, {
516
555
  size: "xs",
517
556
  variant: "ghost",
518
- onClick: () => L(new Date(O.getFullYear(), O.getMonth() - 1, 1)),
557
+ onClick: () => Y(new Date(G.getFullYear(), G.getMonth() - 1, 1)),
558
+ disabled: ue,
519
559
  "aria-label": h("previousMonth"),
520
- children: /* @__PURE__ */ V(C, { className: "rotate-180" })
560
+ children: /* @__PURE__ */ H(C, { className: "rotate-180" })
521
561
  }),
522
- /* @__PURE__ */ V(k, {
562
+ /* @__PURE__ */ H(k, {
523
563
  size: "xs",
524
564
  variant: "ghost",
525
- onClick: () => L(new Date(x.getFullYear(), x.getMonth(), 1)),
565
+ onClick: () => Y(new Date(x.getFullYear(), x.getMonth(), 1)),
526
566
  children: h("today")
527
567
  }),
528
- /* @__PURE__ */ V(k, {
568
+ /* @__PURE__ */ H(k, {
529
569
  size: "xs",
530
570
  variant: "ghost",
531
- onClick: () => L(new Date(O.getFullYear(), O.getMonth() + 1, 1)),
571
+ onClick: () => Y(new Date(G.getFullYear(), G.getMonth() + 1, 1)),
532
572
  "aria-label": h("nextMonth"),
533
- children: /* @__PURE__ */ V(C, {})
573
+ children: /* @__PURE__ */ H(C, {})
534
574
  })
535
575
  ]
536
576
  })
537
577
  ]
538
578
  }),
539
- /* @__PURE__ */ H("div", {
540
- ref: D,
579
+ /* @__PURE__ */ U("div", {
580
+ ref: R,
541
581
  className: "h-[min(72vh,760px)] overflow-y-auto rounded-md border border-border max-sm:hidden",
542
- children: [/* @__PURE__ */ V("div", {
582
+ children: [/* @__PURE__ */ H("div", {
543
583
  className: "sticky top-0 z-10 grid grid-cols-7 border-b border-border bg-card text-xs text-muted-foreground",
544
- style: { height: X },
545
- children: Array.from({ length: 7 }, (e, t) => q(w, t)).map((e) => /* @__PURE__ */ V("span", {
546
- className: N("flex items-center px-2", $(e) && "bg-muted/40"),
584
+ style: { height: Z },
585
+ children: Array.from({ length: 7 }, (e, t) => q(w, t)).map((e) => /* @__PURE__ */ H("span", {
586
+ className: P("flex items-center px-2", Ee(e) && "bg-muted/40"),
547
587
  children: g.dateTime(e, { weekday: "short" })
548
588
  }, e.getDay()))
549
- }), /* @__PURE__ */ V("ol", {
589
+ }), /* @__PURE__ */ H("ol", {
550
590
  className: "relative",
551
- style: { height: M.getTotalSize() - X },
591
+ style: { height: J.getTotalSize() - Z },
552
592
  "aria-label": h("calendarView"),
553
- children: B.map((e) => /* @__PURE__ */ V("li", {
593
+ children: Q.map((e) => /* @__PURE__ */ H("li", {
554
594
  className: "absolute inset-x-0",
555
595
  style: {
556
- height: Y,
557
- transform: `translateY(${e.start - X}px)`
596
+ height: X,
597
+ transform: `translateY(${e.start - Z}px)`
558
598
  },
559
- children: /* @__PURE__ */ V("ol", {
599
+ children: /* @__PURE__ */ H("ol", {
560
600
  className: "grid h-full grid-cols-7",
561
- children: Array.from({ length: 7 }, (t, n) => q(E(e.index), n)).map((e) => {
562
- let t = r(e), n = ye(t), i = n.length - de;
563
- return /* @__PURE__ */ H("li", {
601
+ children: Array.from({ length: 7 }, (t, n) => q(j(e.index), n)).map((e) => {
602
+ let t = r(e), n = Oe(t), i = n.length - de;
603
+ return /* @__PURE__ */ U("li", {
564
604
  "aria-label": g.dateTime(e, { dateStyle: "full" }),
565
- className: N("group flex min-w-0 flex-col gap-1 overflow-hidden border-r border-b border-border p-1 last:border-r-0", $(e) && "bg-muted/40", !ve(e) && "text-muted-foreground"),
605
+ className: P("group flex min-w-0 flex-col gap-1 overflow-hidden border-r border-b border-border p-1 last:border-r-0", Ee(e) && "bg-muted/40", !De(e) && "text-muted-foreground"),
566
606
  children: [
567
- /* @__PURE__ */ H("span", {
607
+ /* @__PURE__ */ U("span", {
568
608
  className: "flex items-center justify-between",
569
- children: [_e(t), /* @__PURE__ */ V("span", {
570
- className: N("ml-auto flex h-6 min-w-6 items-center justify-center whitespace-nowrap rounded-full px-1 text-xs tabular-nums", t === Q && "bg-primary font-medium text-primary-foreground", e.getDate() === 1 && t !== Q && "font-medium"),
609
+ children: [Te(t), /* @__PURE__ */ H("span", {
610
+ className: P("ml-auto flex h-6 min-w-6 items-center justify-center whitespace-nowrap rounded-full px-1 text-xs tabular-nums", t === xe && "bg-primary font-medium text-primary-foreground", e.getDate() === 1 && t !== xe && "font-medium"),
571
611
  children: e.getDate() === 1 ? g.dateTime(e, {
572
612
  month: "short",
573
613
  day: "numeric"
@@ -575,8 +615,8 @@ function pe({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
575
615
  })]
576
616
  }),
577
617
  n.slice(0, i > 0 ? 2 : de),
578
- i > 0 && /* @__PURE__ */ V(j, {
579
- trigger: /* @__PURE__ */ V("button", {
618
+ i > 0 && /* @__PURE__ */ H(M, {
619
+ trigger: /* @__PURE__ */ H("button", {
580
620
  type: "button",
581
621
  className: "self-start rounded px-1 text-xs text-muted-foreground hover:bg-accent hover:text-foreground",
582
622
  children: h("moreOnDay", { count: i + 1 })
@@ -593,47 +633,47 @@ function pe({ workspace: t, docs: i, dateOf: a, toolbar: l, parent: u, space: d,
593
633
  }, e.key))
594
634
  })]
595
635
  }),
596
- /* @__PURE__ */ V("ol", {
636
+ /* @__PURE__ */ H("ol", {
597
637
  className: "divide-y divide-border rounded-md border border-border sm:hidden",
598
- children: be.map((e) => {
638
+ children: ke.map((e) => {
599
639
  let t = r(e);
600
- return /* @__PURE__ */ H("li", {
640
+ return /* @__PURE__ */ U("li", {
601
641
  className: "flex flex-col gap-1 px-3 py-2",
602
- children: [/* @__PURE__ */ H("span", {
642
+ children: [/* @__PURE__ */ U("span", {
603
643
  className: "flex items-center justify-between text-xs",
604
- children: [/* @__PURE__ */ V("span", {
605
- className: t === Q ? "font-medium text-primary" : "text-muted-foreground",
644
+ children: [/* @__PURE__ */ H("span", {
645
+ className: t === xe ? "font-medium text-primary" : "text-muted-foreground",
606
646
  children: g.dateTime(e, {
607
647
  weekday: "long",
608
648
  month: "short",
609
649
  day: "numeric"
610
650
  })
611
- }), _e(t, !0)]
612
- }), ye(t)]
651
+ }), Te(t, !0)]
652
+ }), Oe(t)]
613
653
  }, t);
614
654
  })
615
655
  })
616
656
  ]
617
657
  });
618
658
  }
619
- function Q({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
620
- let a = z("subpages"), o = R(), s = [...t].sort((e, t) => {
659
+ function he({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
660
+ let a = B("subpages"), o = z(), s = [...t].sort((e, t) => {
621
661
  let n = r(e) ?? "", i = r(t) ?? "";
622
662
  return n === i ? t.updatedAt < e.updatedAt ? -1 : 1 : n < i ? 1 : -1;
623
663
  });
624
- return /* @__PURE__ */ H("div", {
664
+ return /* @__PURE__ */ U("div", {
625
665
  className: "flex flex-col",
626
- children: [/* @__PURE__ */ V("div", {
666
+ children: [/* @__PURE__ */ H("div", {
627
667
  className: "flex flex-wrap items-center gap-1 py-2",
628
668
  children: i
629
- }), s.length === 0 ? /* @__PURE__ */ V("p", {
669
+ }), s.length === 0 ? /* @__PURE__ */ H("p", {
630
670
  className: "py-3 text-sm text-muted-foreground",
631
671
  children: a("none")
632
- }) : /* @__PURE__ */ V("ul", {
672
+ }) : /* @__PURE__ */ H("ul", {
633
673
  className: "divide-y divide-border",
634
674
  children: s.map((t) => {
635
675
  let i = r(t);
636
- return /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
676
+ return /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
637
677
  to: "/$workspace/docs/$doc",
638
678
  params: {
639
679
  workspace: e,
@@ -641,16 +681,16 @@ function Q({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
641
681
  },
642
682
  className: "flex items-center gap-3 py-2 text-sm hover:bg-accent/40",
643
683
  children: [
644
- /* @__PURE__ */ V("span", {
684
+ /* @__PURE__ */ H("span", {
645
685
  className: "w-28 shrink-0 text-xs text-muted-foreground tabular-nums",
646
686
  children: i ? o.dateTime(n(i), { dateStyle: "medium" }) : a("undated")
647
687
  }),
648
- /* @__PURE__ */ V(p, { icon: t.icon }),
649
- /* @__PURE__ */ V("span", {
688
+ /* @__PURE__ */ H(p, { icon: t.icon }),
689
+ /* @__PURE__ */ H("span", {
650
690
  className: "min-w-0 flex-1 truncate font-medium",
651
691
  children: t.title
652
692
  }),
653
- /* @__PURE__ */ V("span", {
693
+ /* @__PURE__ */ H("span", {
654
694
  className: "shrink-0 text-xs text-muted-foreground",
655
695
  children: o.relativeTime(new Date(t.updatedAt))
656
696
  })
@@ -660,49 +700,49 @@ function Q({ workspace: e, docs: t, dateOf: r, toolbar: i }) {
660
700
  })]
661
701
  });
662
702
  }
663
- var me = "flex min-w-0 items-center gap-2 font-medium hover:underline";
664
- function he({ workspace: e, docs: t, props: n, toolbar: r }) {
665
- let i = z("subpages"), a = z("docViews"), o = R(), s = m(e);
666
- return /* @__PURE__ */ H("div", {
703
+ var ge = "flex min-w-0 items-center gap-2 font-medium hover:underline";
704
+ function _e({ workspace: e, docs: t, props: n, toolbar: r }) {
705
+ let i = B("subpages"), a = B("docViews"), o = z(), s = m(e);
706
+ return /* @__PURE__ */ U("div", {
667
707
  className: "flex flex-col",
668
- children: [/* @__PURE__ */ V("div", {
708
+ children: [/* @__PURE__ */ H("div", {
669
709
  className: "flex flex-wrap items-center gap-1 py-2",
670
710
  children: r
671
- }), t.length === 0 ? /* @__PURE__ */ V("p", {
711
+ }), t.length === 0 ? /* @__PURE__ */ H("p", {
672
712
  className: "py-3 text-sm text-muted-foreground",
673
713
  children: i("none")
674
- }) : /* @__PURE__ */ V("div", {
714
+ }) : /* @__PURE__ */ H("div", {
675
715
  className: "overflow-x-auto",
676
- children: /* @__PURE__ */ H("table", {
716
+ children: /* @__PURE__ */ U("table", {
677
717
  className: "doc-table w-full min-w-max text-sm",
678
- children: [/* @__PURE__ */ V("thead", { children: /* @__PURE__ */ H("tr", { children: [
679
- /* @__PURE__ */ V("th", {
718
+ children: [/* @__PURE__ */ H("thead", { children: /* @__PURE__ */ U("tr", { children: [
719
+ /* @__PURE__ */ H("th", {
680
720
  scope: "col",
681
721
  children: a("docTitle")
682
722
  }),
683
- n.map((e) => /* @__PURE__ */ V("th", {
723
+ n.map((e) => /* @__PURE__ */ H("th", {
684
724
  scope: "col",
685
725
  children: e.name
686
726
  }, e.id)),
687
- /* @__PURE__ */ V("th", {
727
+ /* @__PURE__ */ H("th", {
688
728
  scope: "col",
689
729
  children: a("updated")
690
730
  })
691
- ] }) }), /* @__PURE__ */ V("tbody", { children: t.map((t) => /* @__PURE__ */ H("tr", { children: [
692
- /* @__PURE__ */ V("td", { children: /* @__PURE__ */ H(F, {
731
+ ] }) }), /* @__PURE__ */ H("tbody", { children: t.map((t) => /* @__PURE__ */ U("tr", { children: [
732
+ /* @__PURE__ */ H("td", { children: /* @__PURE__ */ U(F, {
693
733
  to: "/$workspace/docs/$doc",
694
734
  params: {
695
735
  workspace: e,
696
736
  doc: c(t)
697
737
  },
698
- className: me,
699
- children: [/* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
738
+ className: ge,
739
+ children: [/* @__PURE__ */ H(p, { icon: t.icon }), /* @__PURE__ */ H("span", {
700
740
  className: "truncate",
701
741
  children: t.title
702
742
  })]
703
743
  }) }),
704
- n.map((e) => /* @__PURE__ */ V("td", { children: s(e, t.properties?.[e.id]) }, e.id)),
705
- /* @__PURE__ */ V("td", {
744
+ n.map((e) => /* @__PURE__ */ H("td", { children: s(e, t.properties?.[e.id]) }, e.id)),
745
+ /* @__PURE__ */ H("td", {
706
746
  className: "text-muted-foreground",
707
747
  children: o.dateTime(new Date(t.updatedAt), { dateStyle: "medium" })
708
748
  })
@@ -711,19 +751,19 @@ function he({ workspace: e, docs: t, props: n, toolbar: r }) {
711
751
  })]
712
752
  });
713
753
  }
714
- function ge({ workspace: e, docs: t, toolbar: n }) {
715
- let r = z("subpages"), i = R();
716
- return /* @__PURE__ */ H("div", {
754
+ function ve({ workspace: e, docs: t, toolbar: n }) {
755
+ let r = B("subpages"), i = z();
756
+ return /* @__PURE__ */ U("div", {
717
757
  className: "flex flex-col",
718
- children: [/* @__PURE__ */ V("div", {
758
+ children: [/* @__PURE__ */ H("div", {
719
759
  className: "flex flex-wrap items-center gap-1 py-2",
720
760
  children: n
721
- }), t.length === 0 ? /* @__PURE__ */ V("p", {
761
+ }), t.length === 0 ? /* @__PURE__ */ H("p", {
722
762
  className: "py-3 text-sm text-muted-foreground",
723
763
  children: r("none")
724
- }) : /* @__PURE__ */ V("ul", {
764
+ }) : /* @__PURE__ */ H("ul", {
725
765
  className: "divide-y divide-border",
726
- children: t.map((t) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
766
+ children: t.map((t) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
727
767
  to: "/$workspace/docs/$doc",
728
768
  params: {
729
769
  workspace: e,
@@ -731,12 +771,12 @@ function ge({ workspace: e, docs: t, toolbar: n }) {
731
771
  },
732
772
  className: "flex items-center gap-2 py-2 text-sm hover:bg-accent/40",
733
773
  children: [
734
- /* @__PURE__ */ V(p, { icon: t.icon }),
735
- /* @__PURE__ */ V("span", {
774
+ /* @__PURE__ */ H(p, { icon: t.icon }),
775
+ /* @__PURE__ */ H("span", {
736
776
  className: "min-w-0 flex-1 truncate font-medium",
737
777
  children: t.title
738
778
  }),
739
- /* @__PURE__ */ V("span", {
779
+ /* @__PURE__ */ H("span", {
740
780
  className: "shrink-0 text-xs text-muted-foreground",
741
781
  children: i.relativeTime(new Date(t.updatedAt))
742
782
  })
@@ -745,43 +785,43 @@ function ge({ workspace: e, docs: t, toolbar: n }) {
745
785
  })]
746
786
  });
747
787
  }
748
- function _e({ workspace: e, docs: t, toolbar: n }) {
749
- let r = z("subpages");
750
- return /* @__PURE__ */ H("div", {
788
+ function ye({ workspace: e, docs: t, toolbar: n }) {
789
+ let r = B("subpages");
790
+ return /* @__PURE__ */ U("div", {
751
791
  className: "flex flex-col",
752
- children: [/* @__PURE__ */ V("div", {
792
+ children: [/* @__PURE__ */ H("div", {
753
793
  className: "flex flex-wrap items-center gap-1 py-2",
754
794
  children: n
755
- }), t.length === 0 ? /* @__PURE__ */ V("p", {
795
+ }), t.length === 0 ? /* @__PURE__ */ H("p", {
756
796
  className: "py-3 text-sm text-muted-foreground",
757
797
  children: r("none")
758
- }) : /* @__PURE__ */ V("ul", {
798
+ }) : /* @__PURE__ */ H("ul", {
759
799
  className: "grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-3",
760
800
  "aria-label": r("galleryView"),
761
801
  children: t.map((t) => {
762
802
  let n = v(t.cover ?? "");
763
- return /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H(F, {
803
+ return /* @__PURE__ */ H("li", { children: /* @__PURE__ */ U(F, {
764
804
  to: "/$workspace/docs/$doc",
765
805
  params: {
766
806
  workspace: e,
767
807
  doc: c(t)
768
808
  },
769
809
  className: "flex h-full flex-col overflow-hidden rounded-lg border border-border bg-card text-sm hover:border-primary",
770
- children: [/* @__PURE__ */ V("span", {
810
+ children: [/* @__PURE__ */ H("span", {
771
811
  className: "flex h-28 items-center justify-center bg-muted/50",
772
- children: n ? /* @__PURE__ */ V("img", {
812
+ children: n ? /* @__PURE__ */ H("img", {
773
813
  src: n,
774
814
  alt: "",
775
815
  className: "size-full object-cover",
776
816
  style: { objectPosition: `50% ${t.coverPosition ?? 50}%` }
777
- }) : /* @__PURE__ */ V(p, {
817
+ }) : /* @__PURE__ */ H(p, {
778
818
  icon: t.icon,
779
819
  className: "size-8",
780
820
  emojiClassName: "text-3xl"
781
821
  })
782
- }), /* @__PURE__ */ H("span", {
822
+ }), /* @__PURE__ */ U("span", {
783
823
  className: "flex items-center gap-2 px-3 py-2 font-medium",
784
- children: [n && /* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
824
+ children: [n && /* @__PURE__ */ H(p, { icon: t.icon }), /* @__PURE__ */ H("span", {
785
825
  className: "truncate",
786
826
  children: t.title
787
827
  })]
@@ -792,48 +832,48 @@ function _e({ workspace: e, docs: t, toolbar: n }) {
792
832
  });
793
833
  }
794
834
  var $ = 32;
795
- function ve({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
796
- let o = z("subpages"), s = R(), l = I(() => /* @__PURE__ */ new Date(), []), u = t.flatMap((e) => {
835
+ function be({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
836
+ let o = B("subpages"), s = z(), l = L(() => /* @__PURE__ */ new Date(), []), u = t.flatMap((e) => {
797
837
  let t = i(e), r = t ? n(t) : void 0;
798
838
  return r ? [{
799
839
  doc: e,
800
840
  date: r
801
841
  }] : [];
802
842
  }).sort((e, t) => e.date.getTime() - t.date.getTime()), d = u[0]?.date ?? l, f = q(new Date(Math.min(d.getTime(), l.getTime())), -3), m = u[u.length - 1]?.date ?? l, h = q(new Date(Math.max(m.getTime(), l.getTime())), 4), g = Math.max(28, Math.round((h.getTime() - f.getTime()) / 864e5) + 1), _ = Array.from({ length: g }, (e, t) => q(f, t)), v = (e) => Math.round((e.getTime() - f.getTime()) / 864e5), y = r(l);
803
- return /* @__PURE__ */ H("div", {
843
+ return /* @__PURE__ */ U("div", {
804
844
  className: "flex flex-col",
805
- children: [/* @__PURE__ */ V("div", {
845
+ children: [/* @__PURE__ */ H("div", {
806
846
  className: "flex flex-wrap items-center gap-1 py-2",
807
847
  children: a
808
- }), /* @__PURE__ */ V("div", {
848
+ }), /* @__PURE__ */ H("div", {
809
849
  className: "overflow-x-auto rounded-md border border-border",
810
- children: /* @__PURE__ */ H("div", {
850
+ children: /* @__PURE__ */ U("div", {
811
851
  style: { width: g * $ },
812
852
  className: "relative",
813
- children: [/* @__PURE__ */ V("div", {
853
+ children: [/* @__PURE__ */ H("div", {
814
854
  className: "flex border-b border-border text-xs text-muted-foreground",
815
- children: _.map((e) => /* @__PURE__ */ V("span", {
855
+ children: _.map((e) => /* @__PURE__ */ H("span", {
816
856
  style: { width: $ },
817
- className: N("shrink-0 py-1.5 text-center tabular-nums", (e.getDay() === 0 || e.getDay() === 6) && "bg-muted/40", r(e) === y && "font-semibold text-primary"),
857
+ className: P("shrink-0 py-1.5 text-center tabular-nums", (e.getDay() === 0 || e.getDay() === 6) && "bg-muted/40", r(e) === y && "font-semibold text-primary"),
818
858
  title: s.dateTime(e, { dateStyle: "full" }),
819
859
  children: e.getDate() === 1 || r(e) === r(f) ? s.dateTime(e, {
820
860
  month: "short",
821
861
  day: "numeric"
822
862
  }) : e.getDate()
823
863
  }, r(e)))
824
- }), u.length === 0 ? /* @__PURE__ */ V("p", {
864
+ }), u.length === 0 ? /* @__PURE__ */ H("p", {
825
865
  className: "sticky left-0 px-3 py-4 text-sm text-muted-foreground",
826
866
  children: o("none")
827
- }) : /* @__PURE__ */ H("ol", {
867
+ }) : /* @__PURE__ */ U("ol", {
828
868
  className: "relative py-1",
829
869
  "aria-label": o("timelineView"),
830
- children: [/* @__PURE__ */ V("span", {
870
+ children: [/* @__PURE__ */ H("span", {
831
871
  "aria-hidden": !0,
832
872
  className: "absolute inset-y-0 w-px bg-primary/50",
833
873
  style: { left: v(l) * $ + $ / 2 }
834
- }), u.map(({ doc: t, date: n }) => /* @__PURE__ */ V("li", {
874
+ }), u.map(({ doc: t, date: n }) => /* @__PURE__ */ H("li", {
835
875
  className: "relative h-9",
836
- children: /* @__PURE__ */ H(F, {
876
+ children: /* @__PURE__ */ U(F, {
837
877
  to: "/$workspace/docs/$doc",
838
878
  params: {
839
879
  workspace: e,
@@ -842,7 +882,7 @@ function ve({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
842
882
  "aria-label": `${t.title}, ${s.dateTime(n, { dateStyle: "medium" })}`,
843
883
  style: { left: v(n) * $ + 2 },
844
884
  className: "absolute top-1.5 flex h-6 max-w-72 items-center gap-1 rounded bg-card px-1.5 text-xs shadow-xs ring-1 ring-border hover:bg-accent",
845
- children: [/* @__PURE__ */ V(p, { icon: t.icon }), /* @__PURE__ */ V("span", {
885
+ children: [/* @__PURE__ */ H(p, { icon: t.icon }), /* @__PURE__ */ H("span", {
846
886
  className: "truncate",
847
887
  children: t.title
848
888
  })]
@@ -853,4 +893,4 @@ function ve({ workspace: e, docs: t, dateOf: i, toolbar: a }) {
853
893
  })]
854
894
  });
855
895
  }
856
- export { le as SubpageViews, W as subpageLayouts };
896
+ export { J as SubpageViews, G as subpageLayouts };