@parallelworks/tandem-web 0.192.0 → 0.192.2

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