typerighter 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of typerighter might be problematic. Click here for more details.

@@ -1,364 +0,0 @@
1
- import { l as e } from "./shared-BoWAaUci.js";
2
- import { Fragment as t, computed as n, createApp as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, h as l, inject as u, markRaw as d, mergeProps as f, nextTick as p, openBlock as m, provide as h, reactive as g, readonly as _, ref as v, renderList as y, renderSlot as b, shallowRef as x, toDisplayString as S, unref as C, watch as ee, withKeys as w, withModifiers as T } from "vue";
3
- //#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/isEmptyString.mjs
4
- var E = (e) => e === "", te = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), D = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ne = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), re = (e) => {
5
- let t = ne(e);
6
- return t.charAt(0).toUpperCase() + t.slice(1);
7
- }, O = {
8
- xmlns: "http://www.w3.org/2000/svg",
9
- width: 24,
10
- height: 24,
11
- viewBox: "0 0 24 24",
12
- fill: "none",
13
- stroke: "currentColor",
14
- "stroke-width": 2,
15
- "stroke-linecap": "round",
16
- "stroke-linejoin": "round"
17
- }, ie = /* @__PURE__ */ Symbol("lucide-icons");
18
- function ae() {
19
- return u(ie, {});
20
- }
21
- //#endregion
22
- //#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
23
- var oe = ({ name: e, iconNode: t, "icon-node": r, absoluteStrokeWidth: i, "absolute-stroke-width": a, strokeWidth: o, "stroke-width": s, size: c, color: u, ...d }, { slots: f }) => {
24
- let { size: p, color: m, strokeWidth: h = 2, absoluteStrokeWidth: g = !1, class: _ = "" } = ae(), v = n(() => {
25
- let e = E(i) || E(a) || i === !0 || a === !0 || g === !0, t = o || s || h || O["stroke-width"];
26
- return e ? Number(t) * 24 / Number(c ?? p ?? O.width) : t;
27
- });
28
- return l("svg", {
29
- ...O,
30
- ...d,
31
- width: c ?? p ?? O.width,
32
- height: c ?? p ?? O.height,
33
- stroke: u ?? m ?? O.stroke,
34
- "stroke-width": v.value,
35
- class: te("lucide", _, ...e ? [`lucide-${D(re(e))}-icon`, `lucide-${D(e)}`] : ["lucide-icon"])
36
- }, [...(t ?? r ?? []).map((e) => l(...e)), ...f.default ? [f.default()] : []]);
37
- }, k = (e, t) => (n, { slots: r, attrs: i }) => l(oe, {
38
- ...i,
39
- ...n,
40
- iconNode: t,
41
- name: e
42
- }, r.default ? { default: r.default } : void 0), se = k("corner-left-up", [["path", {
43
- d: "M14 9 9 4 4 9",
44
- key: "1af5af"
45
- }], ["path", {
46
- d: "M20 20h-7a4 4 0 0 1-4-4V4",
47
- key: "1blwi3"
48
- }]]), A = k("file", [["path", {
49
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
50
- key: "1oefj6"
51
- }], ["path", {
52
- d: "M14 2v5a1 1 0 0 0 1 1h5",
53
- key: "wfsgrz"
54
- }]]), j = k("folder-open", [["path", {
55
- d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
56
- key: "usdka0"
57
- }]]), ce = ["href"], le = { key: 1 }, ue = ["href"], de = { class: "td-dir-name" }, fe = { class: "td-dir-count" }, pe = { key: 2 }, me = ["href"], he = { class: "td-dir-name" }, ge = /*@__PURE__*/ c({
58
- __name: "TdDirectoryIndex",
59
- setup(r) {
60
- let c = R(), l = $(), u = n(() => {
61
- let e = c.path, t = l.directoryListings[e] ?? l.directoryListings[e + "/"];
62
- return {
63
- url: e,
64
- subdirectories: t?.subdirectories ?? [],
65
- items: t?.items ?? []
66
- };
67
- }), d = n(() => u.value.url === "/"), f = n(() => e(u.value.url));
68
- return (e, n) => (m(), a("div", null, [
69
- d.value ? i("", !0) : (m(), a("a", {
70
- key: 0,
71
- href: f.value,
72
- class: "td-dir-row"
73
- }, [s(C(se), {
74
- size: 16,
75
- class: "td-dir-icon"
76
- }), n[0] ||= o("span", { class: "td-dir-parent" }, "..", -1)], 8, ce)),
77
- u.value.subdirectories.length > 0 ? (m(), a("div", le, [(m(!0), a(t, null, y(u.value.subdirectories, (e) => (m(), a("a", {
78
- key: e.url,
79
- href: e.url,
80
- class: "td-dir-row"
81
- }, [
82
- s(C(j), {
83
- size: 16,
84
- class: "td-dir-icon"
85
- }),
86
- o("span", de, S(e.name), 1),
87
- o("span", fe, S(e.count), 1)
88
- ], 8, ue))), 128))])) : i("", !0),
89
- u.value.items.length > 0 ? (m(), a("div", pe, [(m(!0), a(t, null, y(u.value.items, (e) => (m(), a("a", {
90
- key: e.url,
91
- href: e.url,
92
- class: "td-dir-row"
93
- }, [s(C(A), {
94
- size: 16,
95
- class: "td-dir-icon"
96
- }), o("span", he, S(e.name), 1)], 8, me))), 128))])) : i("", !0)
97
- ]));
98
- }
99
- }), M = (e, t) => {
100
- let n = e.__vccOpts || e;
101
- for (let [e, r] of t) n[e] = r;
102
- return n;
103
- }, N = /*#__PURE__*/ M(ge, [["__scopeId", "data-v-9aecbee8"]]), _e = [
104
- "id",
105
- "tabindex",
106
- "aria-pressed",
107
- "aria-label",
108
- "onKeydown"
109
- ], ve = { class: "td-flashcard-face td-flashcard-face-question" }, ye = { class: "td-flashcard-label" }, be = { class: "td-flashcard-body" }, xe = { class: "td-flashcard-face td-flashcard-face-key" }, Se = { class: "td-flashcard-label" }, Ce = { class: "td-flashcard-body" }, we = /*#__PURE__*/ M(/* @__PURE__ */ c({
110
- inheritAttrs: !1,
111
- __name: "TdFlashcard",
112
- props: {
113
- id: { default: () => void 0 },
114
- revealed: {
115
- type: Boolean,
116
- default: !1
117
- },
118
- disabled: {
119
- type: Boolean,
120
- default: !1
121
- },
122
- questionLabel: { default: "Question" },
123
- keyLabel: { default: "Answer" }
124
- },
125
- setup(e, { expose: t }) {
126
- let n = v(e.revealed);
127
- ee(() => e.revealed, () => {
128
- n.value = e.revealed;
129
- });
130
- function r() {
131
- if (e.disabled) return n.value;
132
- let t = n.value;
133
- return n.value = !n.value, t;
134
- }
135
- function i() {
136
- let e = n.value;
137
- return n.value = !0, e;
138
- }
139
- function s() {
140
- let e = n.value;
141
- return n.value = !1, e;
142
- }
143
- return t({
144
- flip: r,
145
- showQuestion: s,
146
- showKey: i,
147
- state: _(n)
148
- }), (t, i) => (m(), a("div", f(t.$attrs, {
149
- id: e.id,
150
- class: ["td-flashcard", {
151
- "is-revealed": n.value,
152
- "is-disabled": e.disabled
153
- }],
154
- role: "button",
155
- tabindex: e.disabled ? -1 : 0,
156
- "aria-pressed": n.value,
157
- "aria-label": n.value ? e.keyLabel : e.questionLabel,
158
- onClick: r,
159
- onKeydown: [w(T(r, ["prevent"]), ["enter"]), w(T(r, ["prevent"]), ["space"])]
160
- }), [o("div", ve, [o("p", ye, S(e.questionLabel), 1), o("div", be, [b(t.$slots, "default")])]), o("div", xe, [o("p", Se, S(e.keyLabel), 1), o("div", Ce, [b(t.$slots, "key")])])], 16, _e));
161
- }
162
- }), [["__scopeId", "data-v-95dfbffd"]]), P = typeof window < "u", F = Symbol("typedown-router"), I = {
163
- frontmatter: {},
164
- headings: [],
165
- title: "Not Found"
166
- };
167
- function Te(e, t) {
168
- let n = g({
169
- path: "/",
170
- hash: "",
171
- query: "",
172
- contentSfc: void 0,
173
- data: I
174
- }), r = {
175
- route: n,
176
- async go(e, t) {
177
- e = B(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!P || t?.initialLoad || Ee(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
178
- }
179
- }, i;
180
- async function a(r) {
181
- let a = new URL(r, "http://a.com"), s = i = a.pathname;
182
- try {
183
- let t = await e(s);
184
- if (!t) throw Error(`Page not found: ${s}`);
185
- if (i === s) {
186
- i = void 0;
187
- let { default: e, __pageData: r } = t;
188
- n.path = s, n.contentSfc = d(e), n.data = d(r), o(a), P && p(() => {
189
- L(a.hash);
190
- });
191
- }
192
- } catch {
193
- i === s && (i = void 0, n.path = s, n.contentSfc = t ? d(t) : void 0, n.data = I, o(a));
194
- }
195
- }
196
- function o(e = P ? location : {
197
- search: "",
198
- hash: ""
199
- }) {
200
- n.query = e.search, n.hash = decodeURIComponent(e.hash);
201
- }
202
- return P && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
203
- if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
204
- let t = e.target.closest("a");
205
- if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
206
- let n = t.getAttribute("href");
207
- if (n === null) return;
208
- let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
209
- a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
210
- }, { capture: !0 }), window.addEventListener("popstate", async (e) => {
211
- if (e.state == null) return;
212
- let t = B(location.href);
213
- await a(t), o(), await r.onAfterRouteChange?.(t);
214
- }), window.addEventListener("hashchange", (e) => {
215
- e.preventDefault(), o();
216
- })), r;
217
- }
218
- function L(e) {
219
- if (!e) return;
220
- let t;
221
- try {
222
- t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
223
- } catch {
224
- return;
225
- }
226
- t?.scrollIntoView({ block: "start" });
227
- }
228
- function R() {
229
- return z().route;
230
- }
231
- function z() {
232
- let e = u(F);
233
- if (!e) throw Error("useRouter() called outside of Typedown app");
234
- return e;
235
- }
236
- function Ee(e, { replace: t = !1 } = {}) {
237
- let n = B(location.href);
238
- if (e === n) return L(new URL(e, "http://a.com").hash), !1;
239
- t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
240
- let r = new URL(e, location.origin), i = new URL(n, location.origin);
241
- return r.pathname === i.pathname ? (L(r.hash), !1) : !0;
242
- }
243
- function B(e) {
244
- let t = new URL(e, "http://a.com");
245
- return t.pathname = t.pathname.replace(/\.html$/, ""), t.pathname + t.search + t.hash;
246
- }
247
- //#endregion
248
- //#region src/client/app/components/Content.ts
249
- var V = c({
250
- name: "TypedownContent",
251
- setup() {
252
- let e = R();
253
- return () => e.contentSfc ? l(e.contentSfc) : void 0;
254
- }
255
- }), H = "td-theme";
256
- function U(e) {
257
- if (typeof document > "u") return;
258
- let t = e === "system" ? W() : e;
259
- document.documentElement.classList.toggle("dark", t === "dark");
260
- }
261
- function W() {
262
- return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
263
- }
264
- var G = v("system"), K = v(W()), q = !1;
265
- function J() {
266
- De();
267
- let e = n(() => G.value === "system" ? K.value : G.value), t = n(() => e.value === "dark");
268
- function r(e) {
269
- G.value = e, U(e), typeof localStorage < "u" && localStorage.setItem(H, e);
270
- }
271
- function i() {
272
- r(e.value === "light" ? "dark" : "light");
273
- }
274
- return {
275
- theme: _(G),
276
- effectiveTheme: e,
277
- isDark: t,
278
- setTheme: r,
279
- toggle: i
280
- };
281
- }
282
- function De() {
283
- if (!q) {
284
- if (q = !0, typeof localStorage < "u") {
285
- let e = localStorage.getItem(H);
286
- (e === "light" || e === "dark" || e === "system") && (G.value = e);
287
- }
288
- U(G.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
289
- K.value = W(), G.value === "system" && U("system");
290
- });
291
- }
292
- }
293
- //#endregion
294
- //#region src/client/app/composables/useTdContent.ts
295
- var Y = Symbol("td-content");
296
- function Oe(e) {
297
- let t = J(), r = {
298
- page: n(() => e.data),
299
- frontmatter: n(() => e.data.frontmatter),
300
- title: n(() => e.data.title),
301
- isDark: n(() => t.isDark.value)
302
- };
303
- return h(Y, r), r;
304
- }
305
- function ke() {
306
- let e = u(Y);
307
- if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
308
- return e;
309
- }
310
- //#endregion
311
- //#region src/client/app/index.ts
312
- var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), Ae = Symbol("typedown-search-index");
313
- async function je(e, t, n = {}, i = {}) {
314
- let a = {
315
- title: n.title ?? "",
316
- description: n.description ?? ""
317
- }, o = {
318
- contentTree: i.contentTree ?? {
319
- rootItems: [],
320
- children: []
321
- },
322
- schemas: i.schemas ?? {},
323
- directoryListings: i.directoryListings ?? {}
324
- }, s = Te(e), u = r(c({
325
- name: "TypedownApp",
326
- setup() {
327
- return Oe(s.route), () => l(t);
328
- }
329
- }));
330
- u.provide(F, s), u.provide(X, a), u.provide(Z, o), u.provide(Q, e);
331
- let d = x(i.searchIndex);
332
- return u.provide(Ae, d), u.component("TypedownContent", V), u.component("DirectoryIndex", N), u.component("Flashcard", we), typeof window < "u" && await s.go(location.href, {
333
- replace: !0,
334
- initialLoad: !0
335
- }), {
336
- app: u,
337
- router: s,
338
- searchIndex: d
339
- };
340
- }
341
- function Me() {
342
- return u(Q, void 0);
343
- }
344
- function Ne() {
345
- return u(Ae, x(void 0));
346
- }
347
- function Pe() {
348
- return u(X, {
349
- title: "",
350
- description: ""
351
- });
352
- }
353
- function $() {
354
- return u(Z, {
355
- contentTree: {
356
- rootItems: [],
357
- children: []
358
- },
359
- schemas: {},
360
- directoryListings: {}
361
- });
362
- }
363
- //#endregion
364
- export { $ as a, V as c, N as d, M as f, k as h, Pe as i, R as l, A as m, Me as n, ke as o, j as p, Ne as r, J as s, je as t, z as u };
@@ -1,12 +0,0 @@
1
- //#region src/shared/utils/html.ts
2
- function e(e) {
3
- return e.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
4
- }
5
- function t(e) {
6
- return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
7
- }
8
- //#endregion
9
- //#region src/shared/brand.ts
10
- var n = "m15 10c-2.7614 0-5 2.2386-5 5v98c0 2.761 2.2386 5 5 5h178c2.761 0 5-2.239 5-5v-98c0-2.7614-2.239-5-5-5zm-15 5c0-8.28427 6.71573-15 15-15h178c8.284 0 15 6.71573 15 15v98c0 8.284-6.716 15-15 15h-178c-8.28427 0-15-6.716-15-15z", r = "M30 30h70v16h-27v52h-16v-52h-27z", i = "m155 98-30-33h20v-35h20v35h20z", a = "0 0 208 128", o = "#a0522d", s = `<svg fill='none' viewBox='${a}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${n}' fill-rule='evenodd' fill='${o}'/><path d='${r}' fill='${o}'/><path d='${i}' fill='${o}'/></svg>`, c = `data:image/svg+xml,${encodeURIComponent(s)}`;
11
- //#endregion
12
- export { a, r as i, n, e as o, c as r, t as s, i as t };
@@ -1,192 +0,0 @@
1
- //#region src/shared/constants.ts
2
- var e = "index", t = [".td", ".md"], n = "**/*.{td,md}", r = [
3
- "title",
4
- "titles",
5
- "text"
6
- ], i = ["title", "titles"], a = /^[a-z]+:/i;
7
- //#endregion
8
- //#region src/shared/utils/format.ts
9
- function o(e) {
10
- let t = e.match(/^(\d+)[-_](.+)$/);
11
- return t ? {
12
- order: Number(t[1]),
13
- rest: t[2]
14
- } : {
15
- order: Infinity,
16
- rest: e
17
- };
18
- }
19
- function s(e) {
20
- let { rest: t } = o(e), n = t.replace(/[-_]/g, " ").split(" ");
21
- return 0 < n.length && (n[0] = n[0].charAt(0).toUpperCase() + n[0].slice(1)), n.join(" ");
22
- }
23
- //#endregion
24
- //#region src/shared/utils/path.ts
25
- function c(e, t) {
26
- let n = h(e).split("/").pop() ?? "";
27
- return t !== void 0 && n.endsWith(t) ? n.slice(0, -t.length) : n;
28
- }
29
- function l(e) {
30
- let t = h(e).split("/");
31
- return t.pop(), t.join("/");
32
- }
33
- function u(e) {
34
- let t = c(e), n = t.lastIndexOf(".");
35
- return n <= 0 ? "" : t.slice(n);
36
- }
37
- function d(e) {
38
- let t = c(e), n = t.lastIndexOf(".");
39
- return n <= 0 ? t : t.slice(0, n);
40
- }
41
- function f(e) {
42
- return t.includes(u(e));
43
- }
44
- function p(...e) {
45
- return e.filter(Boolean).join("/").replace(/\\+/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || "/";
46
- }
47
- function m(e) {
48
- let t = u(e);
49
- return t ? e.slice(0, -t.length) : e;
50
- }
51
- function h(e) {
52
- return e.replace(/\\/g, "/");
53
- }
54
- //#endregion
55
- //#region src/shared/utils/url.ts
56
- var g = new Set("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip".split(","));
57
- function _(e, t) {
58
- return `${e}/${t}`;
59
- }
60
- function v(e) {
61
- return l(e.replace(/\/$/, "")) || "/";
62
- }
63
- function y(e) {
64
- let t = d(e);
65
- return "/" + p(l(e), t);
66
- }
67
- function b(e, t) {
68
- return t.startsWith(e + "/") || t === e;
69
- }
70
- function x(e) {
71
- return a.test(e);
72
- }
73
- function S(e) {
74
- let t = u(e).slice(1);
75
- return t === "" || !g.has(t.toLowerCase());
76
- }
77
- function C(e) {
78
- let t = e.indexOf("#");
79
- return 0 <= t ? e.slice(0, t) : e;
80
- }
81
- //#endregion
82
- //#region src/shared/utils/content.ts
83
- function w(e) {
84
- let t = {
85
- name: "",
86
- children: [],
87
- items: []
88
- };
89
- for (let n of e) {
90
- let e = n.filepath.split("/").slice(0, -1), r = t;
91
- for (let t of e) {
92
- let e = r.children.find((e) => e.name === t);
93
- e || (e = {
94
- name: t,
95
- children: [],
96
- items: []
97
- }, r.children.push(e)), r = e;
98
- }
99
- r.items.push(n);
100
- }
101
- return O(t), {
102
- rootItems: t.items,
103
- children: t.children
104
- };
105
- }
106
- function T(e, t) {
107
- let n = {};
108
- function r(e) {
109
- let t = e.items.length;
110
- for (let n of e.children) t += r(n);
111
- return t;
112
- }
113
- function i(e, t) {
114
- let n = e.items[0] ?? e.children[0]?.items[0];
115
- if (!n) return `${t}/${e.name}`;
116
- let r = y(n.filepath);
117
- return d(n.filepath) === "index" ? r : v(r);
118
- }
119
- function a(e, t) {
120
- for (let o of e) {
121
- let e = t ? `${t}/${o.name}` : `/${o.name}`;
122
- n[e] = {
123
- title: s(o.name),
124
- url: e,
125
- subdirectories: o.children.map((t) => ({
126
- name: s(t.name),
127
- url: i(t, e),
128
- count: r(t)
129
- })),
130
- items: o.items.map((e) => ({
131
- name: D(e.header, e.filepath),
132
- url: y(e.filepath)
133
- }))
134
- }, a(o.children, e);
135
- }
136
- }
137
- return n["/"] = {
138
- title: t,
139
- url: "/",
140
- subdirectories: e.map((e) => ({
141
- name: s(e.name),
142
- url: i(e, ""),
143
- count: r(e)
144
- })),
145
- items: []
146
- }, a(e, ""), n;
147
- }
148
- function E(e, t) {
149
- let n = c(l(e));
150
- return n ? s(n) : t;
151
- }
152
- function D(e, t) {
153
- return e._label === void 0 ? e.name === void 0 ? s(d(t)) : String(e.name) : String(e._label);
154
- }
155
- function O(e) {
156
- e.children.sort((e, t) => {
157
- let n = o(e.name), r = o(t.name);
158
- return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
159
- }), e.items.sort((e, t) => {
160
- let n = o(d(e.filepath)), r = o(d(t.filepath));
161
- return n.order === r.order ? D(e.header, e.filepath).localeCompare(D(t.header, t.filepath)) : n.order - r.order;
162
- });
163
- for (let t of e.children) O(t);
164
- }
165
- //#endregion
166
- //#region src/shared/utils/time.ts
167
- var k = 60, A = 60 * k, j = 24 * A, M = 7 * j, N = 30 * j, P = 365 * j, F = 2 * M;
168
- function I(e) {
169
- return (/* @__PURE__ */ new Date(e * 1e3)).toLocaleDateString("en-US", {
170
- year: "numeric",
171
- month: "short",
172
- day: "numeric"
173
- });
174
- }
175
- function L(e, t) {
176
- return Math.floor(Date.now() / 1e3) - e < F ? `${t} ${R(e)}` : `${t} at ${I(e)}`;
177
- }
178
- function R(e) {
179
- let t = Math.floor(Date.now() / 1e3) - e;
180
- return t < k ? "just now" : t < A ? `${Math.floor(t / k)}m ago` : t < j ? `${Math.floor(t / A)}h ago` : t < M ? `${Math.floor(t / j)}d ago` : t < N ? `${Math.floor(t / M)}w ago` : t < P ? `${Math.floor(t / N)}mo ago` : `${Math.floor(t / P)}y ago`;
181
- }
182
- var z = new Intl.DateTimeFormat("en-US", {
183
- year: "numeric",
184
- month: "short",
185
- day: "numeric"
186
- });
187
- function B(e) {
188
- let t = new Date(e);
189
- return Number.isNaN(t.getTime()) ? e : z.format(t);
190
- }
191
- //#endregion
192
- export { r as C, e as S, m as _, T as a, t as b, _ as c, b as d, x as f, f as g, d as h, w as i, v as l, C as m, L as n, E as o, S as p, R as r, D as s, B as t, y as u, s as v, i as w, n as x, a as y };