@tailor-platform/app-shell 0.17.1 → 0.18.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.
- package/dist/app-shell.css +1 -0
- package/dist/app-shell.js +1421 -0
- package/dist/index.d.ts +572 -407
- package/package.json +12 -9
- package/dist/index.css +0 -2
- package/dist/index.js +0 -1
|
@@ -0,0 +1,1421 @@
|
|
|
1
|
+
import { jsx as a, jsxs as c, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { AlertCircle as Y, Table as ft, XIcon as vt, PanelLeftIcon as xt, ChevronRight as D, SunIcon as yt } from "lucide-react";
|
|
3
|
+
import * as b from "react";
|
|
4
|
+
import { createContext as $, useContext as F, useState as K, useMemo as H, useEffect as U, useCallback as Q } from "react";
|
|
5
|
+
import { useRouteError as Tt, isRouteErrorResponse as St, Outlet as W, NavLink as Ct, redirect as ot, Navigate as Nt, createMemoryRouter as kt, createBrowserRouter as Bt, RouterProvider as Pt, useHref as Rt, Link as _t, useLocation as it, useMatch as Et } from "react-router";
|
|
6
|
+
import { Link as sa, useLocation as ra, useNavigate as na, useParams as oa, useRouteError as ia, useSearchParams as la } from "react-router";
|
|
7
|
+
import { Slot as P } from "@radix-ui/react-slot";
|
|
8
|
+
import { cva as lt } from "class-variance-authority";
|
|
9
|
+
import { clsx as It } from "clsx";
|
|
10
|
+
import { twMerge as At } from "tailwind-merge";
|
|
11
|
+
import { capitalCase as k } from "change-case";
|
|
12
|
+
import { Toaster as Lt } from "sonner";
|
|
13
|
+
import * as V from "@radix-ui/react-collapsible";
|
|
14
|
+
import "@radix-ui/react-separator";
|
|
15
|
+
import * as x from "@radix-ui/react-dialog";
|
|
16
|
+
import * as S from "@radix-ui/react-tooltip";
|
|
17
|
+
import * as M from "oauth4webapi";
|
|
18
|
+
function u(...t) {
|
|
19
|
+
return At(It(t));
|
|
20
|
+
}
|
|
21
|
+
const Mt = lt(
|
|
22
|
+
"astw:inline-flex astw:items-center astw:justify-center astw:gap-2 astw:whitespace-nowrap astw:rounded-md astw:text-sm astw:font-medium astw:transition-all astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:[&_svg]:pointer-events-none astw:[&_svg:not([class*='size-'])]:size-4 astw:shrink-0 astw:[&_svg]:shrink-0 astw:outline-none astw:focus-visible:border-ring astw:focus-visible:ring-ring/50 astw:focus-visible:ring-[3px] astw:aria-invalid:ring-destructive/20 astw:dark:aria-invalid:ring-destructive/40 astw:aria-invalid:border-destructive",
|
|
23
|
+
{
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
default: "astw:bg-primary astw:text-primary-foreground astw:shadow-xs astw:hover:bg-primary/90",
|
|
27
|
+
destructive: "astw:bg-destructive astw:text-white astw:shadow-xs astw:hover:bg-destructive/90 astw:focus-visible:ring-destructive/20 astw:dark:focus-visible:ring-destructive/40 astw:dark:bg-destructive/60",
|
|
28
|
+
outline: "astw:border astw:bg-background astw:shadow-xs astw:hover:bg-accent astw:hover:text-accent-foreground astw:dark:bg-input/30 astw:dark:border-input astw:dark:hover:bg-input/50",
|
|
29
|
+
secondary: "astw:bg-secondary astw:text-secondary-foreground astw:shadow-xs astw:hover:bg-secondary/80",
|
|
30
|
+
ghost: "astw:hover:bg-accent astw:hover:text-accent-foreground astw:dark:hover:bg-accent/50",
|
|
31
|
+
link: "astw:text-primary astw:underline-offset-4 astw:hover:underline"
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
default: "astw:h-9 astw:px-4 astw:py-2 astw:has-[>svg]:px-3",
|
|
35
|
+
sm: "astw:h-8 astw:rounded-md astw:gap-1.5 astw:px-3 astw:has-[>svg]:px-2.5",
|
|
36
|
+
lg: "astw:h-10 astw:rounded-md astw:px-6 astw:has-[>svg]:px-4",
|
|
37
|
+
icon: "astw:size-9"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
variant: "default",
|
|
42
|
+
size: "default"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
function B({
|
|
47
|
+
className: t,
|
|
48
|
+
variant: e,
|
|
49
|
+
size: s,
|
|
50
|
+
asChild: r = !1,
|
|
51
|
+
...n
|
|
52
|
+
}) {
|
|
53
|
+
return /* @__PURE__ */ a(
|
|
54
|
+
r ? P : "button",
|
|
55
|
+
{
|
|
56
|
+
"data-slot": "button",
|
|
57
|
+
className: u(Mt({ variant: e, size: s, className: t })),
|
|
58
|
+
...n
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
const C = "en", zt = () => {
|
|
63
|
+
try {
|
|
64
|
+
if (typeof navigator > "u")
|
|
65
|
+
return C;
|
|
66
|
+
const t = navigator.languages?.[0] ?? navigator.language;
|
|
67
|
+
return t ? new Intl.Locale(t).language : C;
|
|
68
|
+
} catch {
|
|
69
|
+
return C;
|
|
70
|
+
}
|
|
71
|
+
}, q = (t) => (e, s) => e ? typeof e == "string" ? e : e(t) ?? s : s, dt = (t) => {
|
|
72
|
+
const e = q(t);
|
|
73
|
+
return (s, r) => e(s, typeof s == "string" ? s : k(r));
|
|
74
|
+
}, Dt = () => {
|
|
75
|
+
const { configurations: t } = y(), e = q(t.locale);
|
|
76
|
+
return (s, r) => e(s, r);
|
|
77
|
+
}, Ot = (t) => {
|
|
78
|
+
const e = (s) => (r) => t[s ?? C]?.[r] ?? t.en[r];
|
|
79
|
+
return {
|
|
80
|
+
/**
|
|
81
|
+
* Hook to get the translated label resolver function.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* import { useT } from "./i18n-labels";
|
|
86
|
+
*
|
|
87
|
+
* const YourComponent = () => {
|
|
88
|
+
* const t = useT();
|
|
89
|
+
*
|
|
90
|
+
* return (
|
|
91
|
+
* <div>
|
|
92
|
+
* {t("staticLabel")}
|
|
93
|
+
* {t("dynamicLabel", { name: "John" })}
|
|
94
|
+
* </div>
|
|
95
|
+
* );
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
useT: () => {
|
|
100
|
+
const { configurations: s } = y(), r = e(s.locale);
|
|
101
|
+
return ((n, ...o) => {
|
|
102
|
+
const l = r(n);
|
|
103
|
+
return typeof l == "function" ? l(o[0]) : l;
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* A function to get the translater for a specific label key.
|
|
108
|
+
* This is expected to be used in `meta.title` in module/resource definitions.
|
|
109
|
+
*
|
|
110
|
+
* Note: When using dynamic labels with props in meta.title, the props are
|
|
111
|
+
* bound at definition time (when calling labels.t), not at render time.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* import { labels } from "./i18n-labels";
|
|
116
|
+
*
|
|
117
|
+
* const resource = defineResource({
|
|
118
|
+
* path: "example",
|
|
119
|
+
* meta: {
|
|
120
|
+
* title: labels.t("someLabelKey"),
|
|
121
|
+
* // or with props for dynamic labels
|
|
122
|
+
* title: labels.t("dynamicKey", { id: "123" }),
|
|
123
|
+
* },
|
|
124
|
+
* component: ExampleComponent,
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
t: (s, ...r) => (n) => {
|
|
129
|
+
const o = e(n)(s);
|
|
130
|
+
return typeof o == "function" ? o(r[0]) : o;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}, jt = Ot({
|
|
134
|
+
en: {
|
|
135
|
+
error404Title: "404 Not Found",
|
|
136
|
+
error404Body: "The page you requested could not be found.",
|
|
137
|
+
goBack: "Go Back",
|
|
138
|
+
errorUnexpected: "An unexpected error occurred",
|
|
139
|
+
errorTitle: "Something went wrong",
|
|
140
|
+
tryAgain: "Try Again",
|
|
141
|
+
welcomeTitle: "Welcome to AppShell",
|
|
142
|
+
welcomeBody: "Add your GraphQL resources from configuration at first!",
|
|
143
|
+
settings: "Settings",
|
|
144
|
+
toggle: "Toggle",
|
|
145
|
+
toggleSidebar: "Toggle Sidebar",
|
|
146
|
+
sidebar: "Sidebar",
|
|
147
|
+
sidebarDesc: "Displays the mobile sidebar.",
|
|
148
|
+
close: "Close",
|
|
149
|
+
more: "More"
|
|
150
|
+
},
|
|
151
|
+
ja: {
|
|
152
|
+
error404Title: "404 ページが見つかりません",
|
|
153
|
+
error404Body: "お探しのページは存在しません。",
|
|
154
|
+
goBack: "戻る",
|
|
155
|
+
errorUnexpected: "予期しないエラーが発生しました",
|
|
156
|
+
errorTitle: "問題が発生しました",
|
|
157
|
+
tryAgain: "再試行",
|
|
158
|
+
welcomeTitle: "AppShell へようこそ",
|
|
159
|
+
welcomeBody: "まず設定から GraphQL リソースを追加してください。",
|
|
160
|
+
settings: "設定",
|
|
161
|
+
toggle: "切り替え",
|
|
162
|
+
toggleSidebar: "サイドバーを切り替え",
|
|
163
|
+
sidebar: "サイドバー",
|
|
164
|
+
sidebarDesc: "モバイル用サイドバーを表示します。",
|
|
165
|
+
close: "閉じる",
|
|
166
|
+
more: "その他"
|
|
167
|
+
}
|
|
168
|
+
}), R = jt.useT, E = () => {
|
|
169
|
+
const t = Tt(), e = R(), s = {
|
|
170
|
+
role: "alert",
|
|
171
|
+
"aria-label": "default-error-boundary"
|
|
172
|
+
};
|
|
173
|
+
if (St(t) && t.status === 404)
|
|
174
|
+
return /* @__PURE__ */ a("div", { ...s, className: "astw:p-6", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:items-start astw:gap-4", children: [
|
|
175
|
+
/* @__PURE__ */ a(Y, { className: "astw:h-5 astw:w-5 astw:text-destructive astw:flex-shrink-0 astw:mt-0.5" }),
|
|
176
|
+
/* @__PURE__ */ c("div", { children: [
|
|
177
|
+
/* @__PURE__ */ a("h1", { className: "astw:font-semibold astw:text-lg", children: e("error404Title") }),
|
|
178
|
+
/* @__PURE__ */ a("p", { className: "astw:text-sm astw:text-muted-foreground astw:mt-1", children: e("error404Body") }),
|
|
179
|
+
/* @__PURE__ */ a(
|
|
180
|
+
B,
|
|
181
|
+
{
|
|
182
|
+
variant: "outline",
|
|
183
|
+
size: "sm",
|
|
184
|
+
className: "astw:mt-4",
|
|
185
|
+
onClick: () => window.history.back(),
|
|
186
|
+
children: e("goBack")
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] })
|
|
190
|
+
] }) });
|
|
191
|
+
const r = t instanceof Error ? t.message : e("errorUnexpected");
|
|
192
|
+
return /* @__PURE__ */ a("div", { ...s, className: "astw:p-6", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:items-start astw:gap-4", children: [
|
|
193
|
+
/* @__PURE__ */ a(Y, { className: "astw:h-5 astw:w-5 astw:text-destructive astw:flex-shrink-0 astw:mt-0.5" }),
|
|
194
|
+
/* @__PURE__ */ c("div", { children: [
|
|
195
|
+
/* @__PURE__ */ a("h1", { className: "astw:font-semibold astw:text-lg", children: e("errorTitle") }),
|
|
196
|
+
/* @__PURE__ */ a("p", { className: "astw:text-sm astw:text-muted-foreground astw:mt-1", children: r }),
|
|
197
|
+
/* @__PURE__ */ a(
|
|
198
|
+
B,
|
|
199
|
+
{
|
|
200
|
+
variant: "outline",
|
|
201
|
+
size: "sm",
|
|
202
|
+
className: "astw:mt-4",
|
|
203
|
+
onClick: () => window.location.reload(),
|
|
204
|
+
children: e("tryAgain")
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] })
|
|
208
|
+
] }) });
|
|
209
|
+
}, $t = (t) => ({
|
|
210
|
+
modules: t.modules,
|
|
211
|
+
settingsResources: t.settingsResources ?? [],
|
|
212
|
+
errorBoundary: t.errorBoundary ?? /* @__PURE__ */ a(E, {}),
|
|
213
|
+
basePath: t.basePath,
|
|
214
|
+
locale: t.locale ?? zt()
|
|
215
|
+
}), ct = $({
|
|
216
|
+
navItems: [],
|
|
217
|
+
configurations: {
|
|
218
|
+
modules: [],
|
|
219
|
+
settingsResources: [],
|
|
220
|
+
errorBoundary: /* @__PURE__ */ a(E, {}),
|
|
221
|
+
locale: C
|
|
222
|
+
}
|
|
223
|
+
}), y = () => F(ct), Ft = () => {
|
|
224
|
+
const t = R();
|
|
225
|
+
return /* @__PURE__ */ c(N, { children: [
|
|
226
|
+
/* @__PURE__ */ a("p", { className: "astw:font-semibold astw:leading-none astw:tracking-tight", children: t("welcomeTitle") }),
|
|
227
|
+
/* @__PURE__ */ a("p", { className: "pt-4", children: t("welcomeBody") })
|
|
228
|
+
] });
|
|
229
|
+
}, J = () => /* @__PURE__ */ c(N, { children: [
|
|
230
|
+
/* @__PURE__ */ a(W, {}),
|
|
231
|
+
/* @__PURE__ */ a(Lt, {})
|
|
232
|
+
] }), Kt = () => {
|
|
233
|
+
const { configurations: t } = y(), e = R(), s = Dt();
|
|
234
|
+
return /* @__PURE__ */ c("div", { className: "astw:mx-auto astw:flex-col astw:flex astw:md:flex-row astw:max-w-5xl astw:gap-[10px] astw:w-full", children: [
|
|
235
|
+
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ c("nav", { className: "astw:bg-card astw:md:w-xs astw:rounded-md astw:border astw:p-3 astw:shadow-xs", children: [
|
|
236
|
+
/* @__PURE__ */ a("h2", { className: "astw:text-sm astw:leading-[36px] astw:mb-2 astw:font-bold ", children: e("settings") }),
|
|
237
|
+
/* @__PURE__ */ a("ul", { className: "astw:flex astw:flex-col astw:gap-1", children: t.settingsResources.map((r) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(Ct, { to: `./${r.path}`, children: ({ isActive: n }) => /* @__PURE__ */ c(
|
|
238
|
+
B,
|
|
239
|
+
{
|
|
240
|
+
variant: n ? "secondary" : "ghost",
|
|
241
|
+
className: "astw:w-full astw:justify-start",
|
|
242
|
+
children: [
|
|
243
|
+
r.meta.icon,
|
|
244
|
+
s(r.meta.title, r.path)
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
) }) }, r.path)) })
|
|
248
|
+
] }) }),
|
|
249
|
+
/* @__PURE__ */ a("section", { className: "astw:bg-card astw:flex-1 astw:rounded-md astw:border astw:shadow-xs", children: /* @__PURE__ */ a(W, {}) })
|
|
250
|
+
] });
|
|
251
|
+
};
|
|
252
|
+
function qe(t) {
|
|
253
|
+
return {
|
|
254
|
+
redirectTo: t
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function O(t) {
|
|
258
|
+
return typeof t == "object" && t !== null && "redirectTo" in t;
|
|
259
|
+
}
|
|
260
|
+
const wt = (t, e) => () => {
|
|
261
|
+
const { configurations: s } = y(), { metaTitle: r, fallbackTitle: n } = t, l = q(s.locale)(r, n);
|
|
262
|
+
return e(l);
|
|
263
|
+
};
|
|
264
|
+
function Ge(t) {
|
|
265
|
+
const { path: e, meta: s, component: r, resources: n, errorBoundary: o } = t, l = s?.title ?? k(e), d = k(e), i = O(r) ? {
|
|
266
|
+
// Use loader for redirects
|
|
267
|
+
component: () => null,
|
|
268
|
+
loader: () => ot(r.redirectTo)
|
|
269
|
+
} : {
|
|
270
|
+
// Regular component with locale-aware title
|
|
271
|
+
component: wt(
|
|
272
|
+
{ metaTitle: l, fallbackTitle: d },
|
|
273
|
+
(w) => r({ title: w, resources: n })
|
|
274
|
+
)
|
|
275
|
+
};
|
|
276
|
+
return {
|
|
277
|
+
path: e,
|
|
278
|
+
type: "component",
|
|
279
|
+
_type: "module",
|
|
280
|
+
...i,
|
|
281
|
+
meta: {
|
|
282
|
+
title: l,
|
|
283
|
+
...s?.breadcrumbTitle !== void 0 ? { breadcrumbTitle: s.breadcrumbTitle } : {},
|
|
284
|
+
...s,
|
|
285
|
+
menuItemClickable: !O(r),
|
|
286
|
+
icon: t.meta?.icon
|
|
287
|
+
},
|
|
288
|
+
resources: n,
|
|
289
|
+
errorBoundary: o || /* @__PURE__ */ a(E, {})
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function Xe(t) {
|
|
293
|
+
const { path: e, component: s, subResources: r, meta: n, errorBoundary: o } = t, l = n?.title ?? k(e), d = k(e);
|
|
294
|
+
return {
|
|
295
|
+
_type: "resource",
|
|
296
|
+
type: "component",
|
|
297
|
+
path: e,
|
|
298
|
+
meta: {
|
|
299
|
+
title: l,
|
|
300
|
+
icon: n?.icon,
|
|
301
|
+
...n?.breadcrumbTitle !== void 0 ? { breadcrumbTitle: n.breadcrumbTitle } : {}
|
|
302
|
+
},
|
|
303
|
+
component: wt(
|
|
304
|
+
{ metaTitle: l, fallbackTitle: d },
|
|
305
|
+
(i) => s({ title: i, resources: r })
|
|
306
|
+
),
|
|
307
|
+
subResources: r,
|
|
308
|
+
errorBoundary: o ?? /* @__PURE__ */ a(E, {})
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
const G = (t) => () => /* @__PURE__ */ a(N, { children: t }), ut = (t, e, s) => {
|
|
312
|
+
const r = t.errorBoundary || s, n = {
|
|
313
|
+
index: !0,
|
|
314
|
+
Component: t.component,
|
|
315
|
+
...t.loader && { loader: t.loader }
|
|
316
|
+
};
|
|
317
|
+
return {
|
|
318
|
+
path: t.path,
|
|
319
|
+
...t.errorBoundary && {
|
|
320
|
+
ErrorBoundary: G(t.errorBoundary)
|
|
321
|
+
},
|
|
322
|
+
...e && e.length > 0 ? {
|
|
323
|
+
children: [
|
|
324
|
+
n,
|
|
325
|
+
...e.map(
|
|
326
|
+
(o) => ut(o, o.subResources, r)
|
|
327
|
+
)
|
|
328
|
+
]
|
|
329
|
+
} : {
|
|
330
|
+
children: [n]
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
}, Ht = (t) => t.map(
|
|
334
|
+
(e) => ut(e, e.resources, e.errorBoundary)
|
|
335
|
+
), Ut = ({
|
|
336
|
+
modules: t,
|
|
337
|
+
settingsResources: e,
|
|
338
|
+
rootComponent: s
|
|
339
|
+
}) => {
|
|
340
|
+
const r = O(s) ? {
|
|
341
|
+
index: !0,
|
|
342
|
+
loader: () => ot(s.redirectTo)
|
|
343
|
+
} : {
|
|
344
|
+
index: !0,
|
|
345
|
+
Component: s ?? Ft
|
|
346
|
+
}, n = e.length > 0 ? [
|
|
347
|
+
{
|
|
348
|
+
path: "settings",
|
|
349
|
+
index: !0,
|
|
350
|
+
Component: () => /* @__PURE__ */ a(
|
|
351
|
+
Nt,
|
|
352
|
+
{
|
|
353
|
+
to: e[0].path,
|
|
354
|
+
relative: "path",
|
|
355
|
+
replace: !0
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
path: "settings",
|
|
361
|
+
Component: Kt,
|
|
362
|
+
children: e.map((o) => ({
|
|
363
|
+
path: o.path,
|
|
364
|
+
Component: o.component,
|
|
365
|
+
...o.errorBoundary && {
|
|
366
|
+
ErrorBoundary: G(o.errorBoundary)
|
|
367
|
+
}
|
|
368
|
+
}))
|
|
369
|
+
}
|
|
370
|
+
] : [];
|
|
371
|
+
return [
|
|
372
|
+
r,
|
|
373
|
+
{
|
|
374
|
+
children: Ht(t)
|
|
375
|
+
},
|
|
376
|
+
...n,
|
|
377
|
+
{
|
|
378
|
+
path: "*",
|
|
379
|
+
loader: () => {
|
|
380
|
+
throw new Response("Not Found", { status: 404 });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
];
|
|
384
|
+
}, Wt = (t) => {
|
|
385
|
+
const { configurations: e } = y(), { rootComponent: s, children: r } = t, n = Ut({
|
|
386
|
+
modules: e.modules,
|
|
387
|
+
settingsResources: e.settingsResources,
|
|
388
|
+
rootComponent: s
|
|
389
|
+
}), o = e.errorBoundary, l = [
|
|
390
|
+
{
|
|
391
|
+
element: r,
|
|
392
|
+
children: o ? [
|
|
393
|
+
{
|
|
394
|
+
element: /* @__PURE__ */ a(W, {}),
|
|
395
|
+
ErrorBoundary: G(o),
|
|
396
|
+
children: n
|
|
397
|
+
}
|
|
398
|
+
] : n
|
|
399
|
+
}
|
|
400
|
+
], d = e.basePath ? "/" + e.basePath : void 0, i = t.memory ? kt(l, {
|
|
401
|
+
basename: d,
|
|
402
|
+
...t.initialEntries ? { initialEntries: t.initialEntries } : {}
|
|
403
|
+
}) : Bt(l, {
|
|
404
|
+
basename: d
|
|
405
|
+
});
|
|
406
|
+
return /* @__PURE__ */ a(Pt, { router: i });
|
|
407
|
+
}, Vt = {
|
|
408
|
+
resolvedTheme: "light",
|
|
409
|
+
theme: "system",
|
|
410
|
+
setTheme: () => null
|
|
411
|
+
}, mt = $(Vt);
|
|
412
|
+
function qt({
|
|
413
|
+
children: t,
|
|
414
|
+
storageKey: e,
|
|
415
|
+
defaultTheme: s = "system",
|
|
416
|
+
...r
|
|
417
|
+
}) {
|
|
418
|
+
const [n, o] = K(
|
|
419
|
+
() => localStorage.getItem(e) || s
|
|
420
|
+
), l = H(() => n !== "system" ? n : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", [n]);
|
|
421
|
+
U(() => {
|
|
422
|
+
const i = window.document.documentElement;
|
|
423
|
+
i.classList.remove("light", "dark"), i.classList.add(l);
|
|
424
|
+
}, [l]);
|
|
425
|
+
const d = {
|
|
426
|
+
resolvedTheme: l,
|
|
427
|
+
theme: n,
|
|
428
|
+
setTheme: (i) => {
|
|
429
|
+
localStorage.setItem(e, i), o(i);
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
return /* @__PURE__ */ a(mt.Provider, { ...r, value: d, children: t });
|
|
433
|
+
}
|
|
434
|
+
const Gt = () => {
|
|
435
|
+
const t = F(mt);
|
|
436
|
+
if (t === void 0)
|
|
437
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
438
|
+
return t;
|
|
439
|
+
}, Ye = (t) => {
|
|
440
|
+
const [e, s] = K(!1);
|
|
441
|
+
U(function() {
|
|
442
|
+
s(!0);
|
|
443
|
+
}, []);
|
|
444
|
+
const r = $t(t), n = H(() => {
|
|
445
|
+
const o = t.modules, l = dt(r.locale);
|
|
446
|
+
return o.map((d) => {
|
|
447
|
+
const i = l(d.meta.title, d.path), w = d.resources.map((m) => ({
|
|
448
|
+
title: l(m.meta.title, m.path),
|
|
449
|
+
url: `${d.path}/${m.path}`
|
|
450
|
+
}));
|
|
451
|
+
return {
|
|
452
|
+
title: i,
|
|
453
|
+
url: d.meta.menuItemClickable ? d.path : void 0,
|
|
454
|
+
clickable: d.component,
|
|
455
|
+
icon: d.meta.icon || /* @__PURE__ */ a(ft, {}),
|
|
456
|
+
isActive: !0,
|
|
457
|
+
items: w
|
|
458
|
+
};
|
|
459
|
+
});
|
|
460
|
+
}, [t.modules, r.locale]);
|
|
461
|
+
return e ? /* @__PURE__ */ a(
|
|
462
|
+
ct.Provider,
|
|
463
|
+
{
|
|
464
|
+
value: {
|
|
465
|
+
title: t.title,
|
|
466
|
+
icon: t.icon,
|
|
467
|
+
configurations: r,
|
|
468
|
+
navItems: n
|
|
469
|
+
},
|
|
470
|
+
children: /* @__PURE__ */ a(qt, { defaultTheme: "system", storageKey: "appshell-ui-theme", children: /* @__PURE__ */ a(Wt, { rootComponent: t.rootComponent, children: t.children }) })
|
|
471
|
+
}
|
|
472
|
+
) : null;
|
|
473
|
+
};
|
|
474
|
+
function Xt({
|
|
475
|
+
...t
|
|
476
|
+
}) {
|
|
477
|
+
return /* @__PURE__ */ a(V.Root, { "data-slot": "collapsible", ...t });
|
|
478
|
+
}
|
|
479
|
+
function Z({
|
|
480
|
+
...t
|
|
481
|
+
}) {
|
|
482
|
+
return /* @__PURE__ */ a(
|
|
483
|
+
V.CollapsibleTrigger,
|
|
484
|
+
{
|
|
485
|
+
"data-slot": "collapsible-trigger",
|
|
486
|
+
...t
|
|
487
|
+
}
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
function Yt({
|
|
491
|
+
...t
|
|
492
|
+
}) {
|
|
493
|
+
return /* @__PURE__ */ a(
|
|
494
|
+
V.CollapsibleContent,
|
|
495
|
+
{
|
|
496
|
+
"data-slot": "collapsible-content",
|
|
497
|
+
...t
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
const z = 768;
|
|
502
|
+
function Qt() {
|
|
503
|
+
const [t, e] = b.useState(
|
|
504
|
+
void 0
|
|
505
|
+
);
|
|
506
|
+
return b.useEffect(() => {
|
|
507
|
+
const s = window.matchMedia(`(max-width: ${z - 1}px)`), r = () => {
|
|
508
|
+
e(window.innerWidth < z);
|
|
509
|
+
};
|
|
510
|
+
return s.addEventListener("change", r), e(window.innerWidth < z), () => s.removeEventListener("change", r);
|
|
511
|
+
}, []), !!t;
|
|
512
|
+
}
|
|
513
|
+
function Jt({ ...t }) {
|
|
514
|
+
return /* @__PURE__ */ a(x.Root, { "data-slot": "sheet", ...t });
|
|
515
|
+
}
|
|
516
|
+
function Zt({
|
|
517
|
+
...t
|
|
518
|
+
}) {
|
|
519
|
+
return /* @__PURE__ */ a(x.Portal, { "data-slot": "sheet-portal", ...t });
|
|
520
|
+
}
|
|
521
|
+
function te({
|
|
522
|
+
className: t,
|
|
523
|
+
...e
|
|
524
|
+
}) {
|
|
525
|
+
return /* @__PURE__ */ a(
|
|
526
|
+
x.Overlay,
|
|
527
|
+
{
|
|
528
|
+
"data-slot": "sheet-overlay",
|
|
529
|
+
className: u(
|
|
530
|
+
"astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=open]:fade-in-0 astw:fixed astw:inset-0 astw:z-50 astw:bg-black/50",
|
|
531
|
+
t
|
|
532
|
+
),
|
|
533
|
+
...e
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
function ee({
|
|
538
|
+
className: t,
|
|
539
|
+
children: e,
|
|
540
|
+
side: s = "right",
|
|
541
|
+
...r
|
|
542
|
+
}) {
|
|
543
|
+
return /* @__PURE__ */ c(Zt, { children: [
|
|
544
|
+
/* @__PURE__ */ a(te, {}),
|
|
545
|
+
/* @__PURE__ */ c(
|
|
546
|
+
x.Content,
|
|
547
|
+
{
|
|
548
|
+
"data-slot": "sheet-content",
|
|
549
|
+
className: u(
|
|
550
|
+
"astw:bg-background astw:data-[state=open]:animate-in astw:data-[state=closed]:animate-out astw:fixed astw:z-50 astw:flex astw:flex-col astw:gap-4 astw:shadow-lg astw:transition astw:ease-in-out astw:data-[state=closed]:duration-300 astw:data-[state=open]:duration-500",
|
|
551
|
+
s === "right" && "astw:data-[state=closed]:slide-out-to-right astw:data-[state=open]:slide-in-from-right astw:inset-y-0 astw:right-0 astw:h-full astw:w-3/4 astw:border-l astw:sm:max-w-sm",
|
|
552
|
+
s === "left" && "astw:data-[state=closed]:slide-out-to-left astw:data-[state=open]:slide-in-from-left astw:inset-y-0 astw:left-0 astw:h-full astw:w-3/4 astw:border-r astw:sm:max-w-sm",
|
|
553
|
+
s === "top" && "astw:data-[state=closed]:slide-out-to-top astw:data-[state=open]:slide-in-from-top astw:inset-x-0 astw:top-0 astw:h-auto astw:border-b",
|
|
554
|
+
s === "bottom" && "astw:data-[state=closed]:slide-out-to-bottom astw:data-[state=open]:slide-in-from-bottom astw:inset-x-0 astw:bottom-0 astw:h-auto astw:border-t",
|
|
555
|
+
t
|
|
556
|
+
),
|
|
557
|
+
...r,
|
|
558
|
+
children: [
|
|
559
|
+
e,
|
|
560
|
+
/* @__PURE__ */ c(x.Close, { className: "astw:ring-offset-bg astw:focus:ring-ring astw:data-[state=open]:bg-secondary astw:absolute astw:top-4 astw:right-4 astw:rounded-xs astw:opacity-70 astw:transition-opacity astw:hover:opacity-100 astw:focus:ring-2 astw:focus:ring-offset-2 astw:focus:outline-hidden astw:disabled:pointer-events-none", children: [
|
|
561
|
+
/* @__PURE__ */ a(vt, { className: "astw:size-4" }),
|
|
562
|
+
/* @__PURE__ */ a("span", { className: "astw:sr-only", children: "Close" })
|
|
563
|
+
] })
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
] });
|
|
568
|
+
}
|
|
569
|
+
function ae({ className: t, ...e }) {
|
|
570
|
+
return /* @__PURE__ */ a(
|
|
571
|
+
"div",
|
|
572
|
+
{
|
|
573
|
+
"data-slot": "sheet-header",
|
|
574
|
+
className: u("astw:flex astw:flex-col astw:gap-1.5 astw:p-4", t),
|
|
575
|
+
...e
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
function se({
|
|
580
|
+
className: t,
|
|
581
|
+
...e
|
|
582
|
+
}) {
|
|
583
|
+
return /* @__PURE__ */ a(
|
|
584
|
+
x.Title,
|
|
585
|
+
{
|
|
586
|
+
"data-slot": "sheet-title",
|
|
587
|
+
className: u("astw:text-foreground astw:font-semibold", t),
|
|
588
|
+
...e
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
function re({
|
|
593
|
+
className: t,
|
|
594
|
+
...e
|
|
595
|
+
}) {
|
|
596
|
+
return /* @__PURE__ */ a(
|
|
597
|
+
x.Description,
|
|
598
|
+
{
|
|
599
|
+
"data-slot": "sheet-description",
|
|
600
|
+
className: u("astw:text-muted-foreground astw:text-sm", t),
|
|
601
|
+
...e
|
|
602
|
+
}
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
function ht({
|
|
606
|
+
delayDuration: t = 0,
|
|
607
|
+
...e
|
|
608
|
+
}) {
|
|
609
|
+
return /* @__PURE__ */ a(
|
|
610
|
+
S.Provider,
|
|
611
|
+
{
|
|
612
|
+
"data-slot": "tooltip-provider",
|
|
613
|
+
delayDuration: t,
|
|
614
|
+
...e
|
|
615
|
+
}
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
function ne({
|
|
619
|
+
...t
|
|
620
|
+
}) {
|
|
621
|
+
return /* @__PURE__ */ a(ht, { children: /* @__PURE__ */ a(S.Root, { "data-slot": "tooltip", ...t }) });
|
|
622
|
+
}
|
|
623
|
+
function oe({
|
|
624
|
+
...t
|
|
625
|
+
}) {
|
|
626
|
+
return /* @__PURE__ */ a(S.Trigger, { "data-slot": "tooltip-trigger", ...t });
|
|
627
|
+
}
|
|
628
|
+
function ie({
|
|
629
|
+
className: t,
|
|
630
|
+
sideOffset: e = 0,
|
|
631
|
+
children: s,
|
|
632
|
+
...r
|
|
633
|
+
}) {
|
|
634
|
+
return /* @__PURE__ */ a(S.Portal, { children: /* @__PURE__ */ c(
|
|
635
|
+
S.Content,
|
|
636
|
+
{
|
|
637
|
+
"data-slot": "tooltip-content",
|
|
638
|
+
sideOffset: e,
|
|
639
|
+
className: u(
|
|
640
|
+
"astw:bg-primary astw:text-primary-foreground astw:animate-in astw:fade-in-0 astw:zoom-in-95 astw:data-[state=closed]:animate-out astw:data-[state=closed]:fade-out-0 astw:data-[state=closed]:zoom-out-95 astw:data-[side=bottom]:slide-in-from-top-2 astw:data-[side=left]:slide-in-from-right-2 astw:data-[side=right]:slide-in-from-left-2 astw:data-[side=top]:slide-in-from-bottom-2 astw:z-50 astw:w-fit astw:origin-(--radix-tooltip-content-transform-origin) astw:rounded-md astw:px-3 astw:py-1.5 astw:text-xs astw:text-balance",
|
|
641
|
+
t
|
|
642
|
+
),
|
|
643
|
+
...r,
|
|
644
|
+
children: [
|
|
645
|
+
s,
|
|
646
|
+
/* @__PURE__ */ a(S.Arrow, { className: "astw:bg-primary astw:fill-primary astw:z-50 astw:size-2.5 astw:translate-y-[calc(-50%_-_2px)] astw:rotate-45 astw:rounded-[2px]" })
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
) });
|
|
650
|
+
}
|
|
651
|
+
const le = "sidebar_state", de = 3600 * 24 * 7, ce = "16rem", we = "18rem", ue = "3rem", me = "b", pt = b.createContext(null);
|
|
652
|
+
function I() {
|
|
653
|
+
const t = b.useContext(pt);
|
|
654
|
+
if (!t)
|
|
655
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
656
|
+
return t;
|
|
657
|
+
}
|
|
658
|
+
function he({
|
|
659
|
+
defaultOpen: t = !0,
|
|
660
|
+
open: e,
|
|
661
|
+
onOpenChange: s,
|
|
662
|
+
className: r,
|
|
663
|
+
style: n,
|
|
664
|
+
children: o,
|
|
665
|
+
...l
|
|
666
|
+
}) {
|
|
667
|
+
const d = Qt(), [i, w] = b.useState(!1), [m, h] = b.useState(t), g = e ?? m, v = b.useCallback(
|
|
668
|
+
(p) => {
|
|
669
|
+
const f = typeof p == "function" ? p(g) : p;
|
|
670
|
+
s ? s(f) : h(f), document.cookie = `${le}=${f}; path=/; max-age=${de}`;
|
|
671
|
+
},
|
|
672
|
+
[s, g]
|
|
673
|
+
), T = b.useCallback(() => d ? w((p) => !p) : v((p) => !p), [d, v, w]);
|
|
674
|
+
b.useEffect(() => {
|
|
675
|
+
const p = (f) => {
|
|
676
|
+
f.key === me && (f.metaKey || f.ctrlKey) && (f.preventDefault(), T());
|
|
677
|
+
};
|
|
678
|
+
return window.addEventListener("keydown", p), () => window.removeEventListener("keydown", p);
|
|
679
|
+
}, [T]);
|
|
680
|
+
const _ = g ? "expanded" : "collapsed", X = b.useMemo(
|
|
681
|
+
() => ({
|
|
682
|
+
state: _,
|
|
683
|
+
open: g,
|
|
684
|
+
setOpen: v,
|
|
685
|
+
isMobile: d,
|
|
686
|
+
openMobile: i,
|
|
687
|
+
setOpenMobile: w,
|
|
688
|
+
toggleSidebar: T
|
|
689
|
+
}),
|
|
690
|
+
[_, g, v, d, i, w, T]
|
|
691
|
+
);
|
|
692
|
+
return /* @__PURE__ */ a(pt.Provider, { value: X, children: /* @__PURE__ */ a(ht, { delayDuration: 0, children: /* @__PURE__ */ a(
|
|
693
|
+
"div",
|
|
694
|
+
{
|
|
695
|
+
"data-slot": "sidebar-wrapper",
|
|
696
|
+
style: {
|
|
697
|
+
"--sidebar-width": ce,
|
|
698
|
+
"--sidebar-width-icon": ue,
|
|
699
|
+
...n
|
|
700
|
+
},
|
|
701
|
+
className: u(
|
|
702
|
+
"astw:group/sidebar-wrapper astw:has-data-[variant=inset]:bg-sidebar astw:flex astw:min-h-svh astw:w-full",
|
|
703
|
+
r
|
|
704
|
+
),
|
|
705
|
+
...l,
|
|
706
|
+
children: o
|
|
707
|
+
}
|
|
708
|
+
) }) });
|
|
709
|
+
}
|
|
710
|
+
function pe({
|
|
711
|
+
side: t = "left",
|
|
712
|
+
variant: e = "sidebar",
|
|
713
|
+
collapsible: s = "offcanvas",
|
|
714
|
+
className: r,
|
|
715
|
+
children: n,
|
|
716
|
+
...o
|
|
717
|
+
}) {
|
|
718
|
+
const { isMobile: l, state: d, openMobile: i, setOpenMobile: w } = I();
|
|
719
|
+
return s === "none" ? /* @__PURE__ */ a(
|
|
720
|
+
"div",
|
|
721
|
+
{
|
|
722
|
+
"data-slot": "sidebar",
|
|
723
|
+
className: u(
|
|
724
|
+
"astw:bg-sidebar astw:text-sidebar-foreground astw:flex astw:h-full astw:w-(--sidebar-width) astw:flex-col",
|
|
725
|
+
r
|
|
726
|
+
),
|
|
727
|
+
...o,
|
|
728
|
+
children: n
|
|
729
|
+
}
|
|
730
|
+
) : l ? /* @__PURE__ */ a(Jt, { open: i, onOpenChange: w, ...o, children: /* @__PURE__ */ c(
|
|
731
|
+
ee,
|
|
732
|
+
{
|
|
733
|
+
"data-sidebar": "sidebar",
|
|
734
|
+
"data-slot": "sidebar",
|
|
735
|
+
"data-mobile": "true",
|
|
736
|
+
className: "astw:bg-sidebar astw:text-sidebar-foreground astw:w-(--sidebar-width) astw:p-0 astw:[&>button]:hidden",
|
|
737
|
+
style: {
|
|
738
|
+
"--sidebar-width": we
|
|
739
|
+
},
|
|
740
|
+
side: t,
|
|
741
|
+
children: [
|
|
742
|
+
/* @__PURE__ */ c(ae, { className: "astw:sr-only", children: [
|
|
743
|
+
/* @__PURE__ */ a(se, { children: "Sidebar" }),
|
|
744
|
+
/* @__PURE__ */ a(re, { children: "Displays the mobile sidebar." })
|
|
745
|
+
] }),
|
|
746
|
+
/* @__PURE__ */ a("div", { className: "flex h-full w-full flex-col", children: n })
|
|
747
|
+
]
|
|
748
|
+
}
|
|
749
|
+
) }) : /* @__PURE__ */ c(
|
|
750
|
+
"div",
|
|
751
|
+
{
|
|
752
|
+
className: "astw:group astw:peer astw:text-sidebar-foreground astw:hidden astw:md:block",
|
|
753
|
+
"data-state": d,
|
|
754
|
+
"data-collapsible": d === "collapsed" ? s : "",
|
|
755
|
+
"data-variant": e,
|
|
756
|
+
"data-side": t,
|
|
757
|
+
"data-slot": "sidebar",
|
|
758
|
+
children: [
|
|
759
|
+
/* @__PURE__ */ a(
|
|
760
|
+
"div",
|
|
761
|
+
{
|
|
762
|
+
"data-slot": "sidebar-gap",
|
|
763
|
+
className: u(
|
|
764
|
+
"astw:relative astw:w-(--sidebar-width) astw:bg-transparent astw:transition-[width] astw:duration-200 astw:ease-linear",
|
|
765
|
+
"astw:group-data-[collapsible=offcanvas]:w-0",
|
|
766
|
+
"astw:group-data-[side=right]:rotate-180",
|
|
767
|
+
e === "floating" || e === "inset" ? "astw:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "astw:group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
768
|
+
)
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
/* @__PURE__ */ a(
|
|
772
|
+
"div",
|
|
773
|
+
{
|
|
774
|
+
"data-slot": "sidebar-container",
|
|
775
|
+
className: u(
|
|
776
|
+
"astw:fixed astw:inset-y-0 astw:z-10 astw:hidden astw:h-svh astw:w-(--sidebar-width) astw:transition-[left,right,width] astw:duration-200 astw:ease-linear astw:md:flex",
|
|
777
|
+
t === "left" ? "astw:left-0 astw:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "astw:right-0 astw:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
778
|
+
// Adjust the padding for floating and inset variants.
|
|
779
|
+
e === "floating" || e === "inset" ? "astw:p-2 astw:group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "astw:group-data-[collapsible=icon]:w-(--sidebar-width-icon) astw:group-data-[side=left]:border-r astw:group-data-[side=right]:border-l",
|
|
780
|
+
e === "inset" && "astw:border-x astw:border-x-border",
|
|
781
|
+
r
|
|
782
|
+
),
|
|
783
|
+
...o,
|
|
784
|
+
children: /* @__PURE__ */ a(
|
|
785
|
+
"div",
|
|
786
|
+
{
|
|
787
|
+
"data-sidebar": "sidebar",
|
|
788
|
+
"data-slot": "sidebar-inner",
|
|
789
|
+
className: "astw:bg-sidebar astw:group-data-[variant=floating]:border-sidebar-border astw:flex astw:h-full astw:w-full astw:flex-col astw:group-data-[variant=floating]:rounded-lg astw:group-data-[variant=floating]:border astw:group-data-[variant=floating]:shadow-sm",
|
|
790
|
+
children: n
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
}
|
|
794
|
+
)
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
function gt({
|
|
800
|
+
className: t,
|
|
801
|
+
onClick: e,
|
|
802
|
+
...s
|
|
803
|
+
}) {
|
|
804
|
+
const { toggleSidebar: r } = I();
|
|
805
|
+
return /* @__PURE__ */ c(
|
|
806
|
+
B,
|
|
807
|
+
{
|
|
808
|
+
"data-sidebar": "trigger",
|
|
809
|
+
"data-slot": "sidebar-trigger",
|
|
810
|
+
variant: "ghost",
|
|
811
|
+
size: "icon",
|
|
812
|
+
className: u("astw:text-muted-foreground", t),
|
|
813
|
+
onClick: (n) => {
|
|
814
|
+
e?.(n), r();
|
|
815
|
+
},
|
|
816
|
+
...s,
|
|
817
|
+
children: [
|
|
818
|
+
/* @__PURE__ */ a(xt, { className: "astw:size-4.5" }),
|
|
819
|
+
/* @__PURE__ */ a("span", { className: "astw:sr-only", children: "Toggle Sidebar" })
|
|
820
|
+
]
|
|
821
|
+
}
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
function ge({ className: t, ...e }) {
|
|
825
|
+
return /* @__PURE__ */ a(
|
|
826
|
+
"main",
|
|
827
|
+
{
|
|
828
|
+
"data-slot": "sidebar-inset",
|
|
829
|
+
className: u(
|
|
830
|
+
"astw:bg-background astw:relative astw:flex astw:w-full astw:flex-1 astw:flex-col",
|
|
831
|
+
"astw:px-4 astw:md:peer-data-[variant=inset]:px-8 astw:md:peer-data-[variant=inset]:py-2",
|
|
832
|
+
// astw:md:peer-data-[variant=inset]:peer-data-[state=collapsed]:pl-2
|
|
833
|
+
t
|
|
834
|
+
),
|
|
835
|
+
...e
|
|
836
|
+
}
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
function be({ className: t, ...e }) {
|
|
840
|
+
return /* @__PURE__ */ a(
|
|
841
|
+
"div",
|
|
842
|
+
{
|
|
843
|
+
"data-slot": "sidebar-header",
|
|
844
|
+
"data-sidebar": "header",
|
|
845
|
+
className: u("astw:flex astw:flex-row astw:items-center astw:gap-0.5 astw:p-2", t),
|
|
846
|
+
...e
|
|
847
|
+
}
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
function fe({ className: t, ...e }) {
|
|
851
|
+
return /* @__PURE__ */ a(
|
|
852
|
+
"div",
|
|
853
|
+
{
|
|
854
|
+
"data-slot": "sidebar-content",
|
|
855
|
+
"data-sidebar": "content",
|
|
856
|
+
className: u(
|
|
857
|
+
"astw:flex astw:min-h-0 astw:flex-1 astw:flex-col astw:gap-2 astw:overflow-auto astw:group-data-[collapsible=icon]:overflow-hidden",
|
|
858
|
+
t
|
|
859
|
+
),
|
|
860
|
+
...e
|
|
861
|
+
}
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
function ve({ className: t, ...e }) {
|
|
865
|
+
return /* @__PURE__ */ a(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
"data-slot": "sidebar-group",
|
|
869
|
+
"data-sidebar": "group",
|
|
870
|
+
className: u("astw:relative astw:flex astw:w-full astw:min-w-0 astw:flex-col astw:p-2", t),
|
|
871
|
+
...e
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
function xe({ className: t, ...e }) {
|
|
876
|
+
return /* @__PURE__ */ a(
|
|
877
|
+
"ul",
|
|
878
|
+
{
|
|
879
|
+
"data-slot": "sidebar-menu",
|
|
880
|
+
"data-sidebar": "menu",
|
|
881
|
+
className: u("astw:flex astw:w-full astw:min-w-0 astw:flex-col astw:gap-1", t),
|
|
882
|
+
...e
|
|
883
|
+
}
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
function ye({ className: t, ...e }) {
|
|
887
|
+
return /* @__PURE__ */ a(
|
|
888
|
+
"li",
|
|
889
|
+
{
|
|
890
|
+
"data-slot": "sidebar-menu-item",
|
|
891
|
+
"data-sidebar": "menu-item",
|
|
892
|
+
className: u("astw:group/menu-item astw:relative", t),
|
|
893
|
+
...e
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
const Te = lt(
|
|
898
|
+
"astw:peer/menu-button astw:flex astw:w-full astw:items-center astw:gap-2 astw:overflow-hidden astw:rounded-md astw:p-2 astw:text-left astw:text-sm astw:outline-hidden astw:ring-sidebar-ring astw:transition-[width,height,padding] astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:focus-visible:ring-2 astw:active:bg-sidebar-accent astw:active:text-sidebar-accent-foreground astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:group-has-data-[sidebar=menu-action]/menu-item:pr-8 astw:aria-disabled:pointer-events-none astw:aria-disabled:opacity-50 astw:data-[active=true]:bg-sidebar-accent astw:data-[active=true]:font-medium astw:data-[active=true]:text-sidebar-accent-foreground astw:data-[state=open]:hover:bg-sidebar-accent astw:data-[state=open]:hover:text-sidebar-accent-foreground astw:group-data-[collapsible=icon]:size-8! astw:group-data-[collapsible=icon]:p-2! astw:[&>span:last-child]:truncate astw:[&>svg]:size-4 astw:[&>svg]:shrink-0",
|
|
899
|
+
{
|
|
900
|
+
variants: {
|
|
901
|
+
variant: {
|
|
902
|
+
default: "astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground",
|
|
903
|
+
outline: "astw:bg-background astw:shadow-[0_0_0_1px_hsl(var(--sidebar-border))] astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
904
|
+
},
|
|
905
|
+
size: {
|
|
906
|
+
default: "astw:h-8 astw:text-sm",
|
|
907
|
+
sm: "astw:h-7 astw:rounded-md astw:gap-1.5 astw:px-3 astw:has-[>svg]:px-2.5",
|
|
908
|
+
lg: "astw:h-12 astw:text-sm astw:group-data-[collapsible=icon]:p-0!"
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
defaultVariants: {
|
|
912
|
+
variant: "default",
|
|
913
|
+
size: "default"
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
);
|
|
917
|
+
function tt({
|
|
918
|
+
asChild: t = !1,
|
|
919
|
+
isActive: e = !1,
|
|
920
|
+
variant: s = "default",
|
|
921
|
+
size: r = "default",
|
|
922
|
+
tooltip: n,
|
|
923
|
+
className: o,
|
|
924
|
+
...l
|
|
925
|
+
}) {
|
|
926
|
+
const d = t ? P : "button", { isMobile: i, state: w } = I(), m = /* @__PURE__ */ a(
|
|
927
|
+
d,
|
|
928
|
+
{
|
|
929
|
+
"data-slot": "sidebar-menu-button",
|
|
930
|
+
"data-sidebar": "menu-button",
|
|
931
|
+
"data-size": r,
|
|
932
|
+
"data-active": e,
|
|
933
|
+
className: u(Te({ variant: s, size: r }), o),
|
|
934
|
+
...l
|
|
935
|
+
}
|
|
936
|
+
);
|
|
937
|
+
return n ? (typeof n == "string" && (n = {
|
|
938
|
+
children: n
|
|
939
|
+
}), /* @__PURE__ */ c(ne, { children: [
|
|
940
|
+
/* @__PURE__ */ a(oe, { asChild: !0, children: m }),
|
|
941
|
+
/* @__PURE__ */ a(
|
|
942
|
+
ie,
|
|
943
|
+
{
|
|
944
|
+
side: "right",
|
|
945
|
+
align: "center",
|
|
946
|
+
hidden: w !== "collapsed" || i,
|
|
947
|
+
...n
|
|
948
|
+
}
|
|
949
|
+
)
|
|
950
|
+
] })) : m;
|
|
951
|
+
}
|
|
952
|
+
function et({
|
|
953
|
+
className: t,
|
|
954
|
+
asChild: e = !1,
|
|
955
|
+
showOnHover: s = !1,
|
|
956
|
+
...r
|
|
957
|
+
}) {
|
|
958
|
+
return /* @__PURE__ */ a(
|
|
959
|
+
e ? P : "button",
|
|
960
|
+
{
|
|
961
|
+
"data-slot": "sidebar-menu-action",
|
|
962
|
+
"data-sidebar": "menu-action",
|
|
963
|
+
className: u(
|
|
964
|
+
"astw:text-sidebar-foreground astw:ring-sidebar-ring astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:peer-hover/menu-button:text-sidebar-accent-foreground astw:absolute astw:top-1.5 astw:right-1 astw:flex astw:aspect-square astw:w-5 astw:items-center astw:justify-center astw:rounded-md astw:p-0 astw:outline-hidden astw:transition-transform astw:focus-visible:ring-2 astw:[&>svg]:size-4 astw:[&>svg]:shrink-0",
|
|
965
|
+
// Increases the hit area of the button on mobile.
|
|
966
|
+
"astw:after:absolute astw:after:-inset-2 astw:md:after:hidden",
|
|
967
|
+
"astw:peer-data-[size=sm]/menu-button:top-1",
|
|
968
|
+
"astw:peer-data-[size=default]/menu-button:top-1.5",
|
|
969
|
+
"astw:peer-data-[size=lg]/menu-button:top-2.5",
|
|
970
|
+
"astw:group-data-[collapsible=icon]:hidden",
|
|
971
|
+
s && "astw:peer-data-[active=true]/menu-button:text-sidebar-accent-foreground astw:group-focus-within/menu-item:opacity-100 astw:group-hover/menu-item:opacity-100 astw:data-[state=open]:opacity-100 astw:md:opacity-0",
|
|
972
|
+
t
|
|
973
|
+
),
|
|
974
|
+
...r
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
function Se({ className: t, ...e }) {
|
|
979
|
+
return /* @__PURE__ */ a(
|
|
980
|
+
"ul",
|
|
981
|
+
{
|
|
982
|
+
"data-slot": "sidebar-menu-sub",
|
|
983
|
+
"data-sidebar": "menu-sub",
|
|
984
|
+
className: u(
|
|
985
|
+
"astw:border-sidebar-border astw:mx-3.5 astw:flex astw:min-w-0 astw:translate-x-px astw:flex-col astw:gap-1 astw:border-l astw:px-2.5 astw:py-0.5",
|
|
986
|
+
"astw:group-data-[collapsible=icon]:hidden",
|
|
987
|
+
t
|
|
988
|
+
),
|
|
989
|
+
...e
|
|
990
|
+
}
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
function Ce({
|
|
994
|
+
className: t,
|
|
995
|
+
...e
|
|
996
|
+
}) {
|
|
997
|
+
return /* @__PURE__ */ a(
|
|
998
|
+
"li",
|
|
999
|
+
{
|
|
1000
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
1001
|
+
"data-sidebar": "menu-sub-item",
|
|
1002
|
+
className: u("astw:group/menu-sub-item astw:relative", t),
|
|
1003
|
+
...e
|
|
1004
|
+
}
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1007
|
+
function Ne({
|
|
1008
|
+
asChild: t = !1,
|
|
1009
|
+
size: e = "md",
|
|
1010
|
+
isActive: s = !1,
|
|
1011
|
+
className: r,
|
|
1012
|
+
...n
|
|
1013
|
+
}) {
|
|
1014
|
+
return /* @__PURE__ */ a(
|
|
1015
|
+
t ? P : "a",
|
|
1016
|
+
{
|
|
1017
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
1018
|
+
"data-sidebar": "menu-sub-button",
|
|
1019
|
+
"data-size": e,
|
|
1020
|
+
"data-active": s,
|
|
1021
|
+
className: u(
|
|
1022
|
+
"astw:text-sidebar-foreground astw:ring-sidebar-ring astw:hover:bg-sidebar-accent astw:hover:text-sidebar-accent-foreground astw:active:bg-sidebar-accent astw:active:text-sidebar-accent-foreground astw:[&>svg]:text-sidebar-accent-foreground astw:flex astw:h-7 astw:min-w-0 astw:-translate-x-px astw:items-center astw:gap-2 astw:overflow-hidden astw:rounded-md astw:px-2 astw:outline-hidden astw:focus-visible:ring-2 astw:disabled:pointer-events-none astw:disabled:opacity-50 astw:aria-disabled:pointer-events-none astw:aria-disabled:opacity-50 astw:[&>span:last-child]:truncate astw:[&>svg]:size-4 astw:[&>svg]:shrink-0",
|
|
1023
|
+
"astw:data-[active=true]:bg-sidebar-accent astw:data-[active=true]:text-sidebar-accent-foreground",
|
|
1024
|
+
e === "sm" && "astw:text-xs",
|
|
1025
|
+
e === "md" && "astw:text-sm",
|
|
1026
|
+
"astw:group-data-[collapsible=icon]:hidden",
|
|
1027
|
+
r
|
|
1028
|
+
),
|
|
1029
|
+
...n
|
|
1030
|
+
}
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
function j({ to: t, children: e, ...s }) {
|
|
1034
|
+
try {
|
|
1035
|
+
return Rt(t), /* @__PURE__ */ a(_t, { to: t, ...s, children: e });
|
|
1036
|
+
} catch {
|
|
1037
|
+
return /* @__PURE__ */ a("a", { href: t, ...s, children: e });
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
function at({ ...t }) {
|
|
1041
|
+
return /* @__PURE__ */ a("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...t });
|
|
1042
|
+
}
|
|
1043
|
+
function st({ className: t, ...e }) {
|
|
1044
|
+
return /* @__PURE__ */ a(
|
|
1045
|
+
"ol",
|
|
1046
|
+
{
|
|
1047
|
+
"data-slot": "breadcrumb-list",
|
|
1048
|
+
className: u(
|
|
1049
|
+
"astw:text-muted-foreground astw:flex astw:flex-wrap astw:items-center astw:gap-1.5 astw:text-sm astw:break-words astw:sm:gap-2.5",
|
|
1050
|
+
t
|
|
1051
|
+
),
|
|
1052
|
+
...e
|
|
1053
|
+
}
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
function rt({ className: t, ...e }) {
|
|
1057
|
+
return /* @__PURE__ */ a(
|
|
1058
|
+
"li",
|
|
1059
|
+
{
|
|
1060
|
+
"data-slot": "breadcrumb-item",
|
|
1061
|
+
className: u("astw:inline-flex astw:items-center astw:gap-1.5", t),
|
|
1062
|
+
...e
|
|
1063
|
+
}
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
function nt({
|
|
1067
|
+
asChild: t,
|
|
1068
|
+
className: e,
|
|
1069
|
+
children: s,
|
|
1070
|
+
...r
|
|
1071
|
+
}) {
|
|
1072
|
+
return /* @__PURE__ */ a(
|
|
1073
|
+
t ? P : j,
|
|
1074
|
+
{
|
|
1075
|
+
"data-slot": "breadcrumb-link",
|
|
1076
|
+
className: u("astw:hover:text-foreground astw:transition-colors", e),
|
|
1077
|
+
...r,
|
|
1078
|
+
children: s
|
|
1079
|
+
}
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
function ke({
|
|
1083
|
+
children: t,
|
|
1084
|
+
className: e,
|
|
1085
|
+
...s
|
|
1086
|
+
}) {
|
|
1087
|
+
return /* @__PURE__ */ a(
|
|
1088
|
+
"li",
|
|
1089
|
+
{
|
|
1090
|
+
"data-slot": "breadcrumb-separator",
|
|
1091
|
+
role: "presentation",
|
|
1092
|
+
"aria-hidden": "true",
|
|
1093
|
+
className: u("astw:[&>svg]:size-3.5", e),
|
|
1094
|
+
...s,
|
|
1095
|
+
children: t ?? /* @__PURE__ */ a(D, {})
|
|
1096
|
+
}
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
const Be = (t, e) => {
|
|
1100
|
+
const s = dt(e);
|
|
1101
|
+
return t.reduce(
|
|
1102
|
+
(r, n) => {
|
|
1103
|
+
const o = s(n.meta.title, n.path);
|
|
1104
|
+
r[n.path] = {
|
|
1105
|
+
title: o,
|
|
1106
|
+
breadcrumbTitle: n.meta.breadcrumbTitle
|
|
1107
|
+
};
|
|
1108
|
+
const l = (d, i) => {
|
|
1109
|
+
!d || d.length === 0 || d.forEach((w) => {
|
|
1110
|
+
const m = `${i}/${w.path}`, h = s(
|
|
1111
|
+
w.meta.title,
|
|
1112
|
+
w.path
|
|
1113
|
+
);
|
|
1114
|
+
r[m] = {
|
|
1115
|
+
title: h,
|
|
1116
|
+
breadcrumbTitle: w.meta.breadcrumbTitle
|
|
1117
|
+
}, w.subResources && w.subResources.length > 0 && l(
|
|
1118
|
+
w.subResources,
|
|
1119
|
+
m
|
|
1120
|
+
);
|
|
1121
|
+
});
|
|
1122
|
+
};
|
|
1123
|
+
return n.resources && n.resources.length > 0 && l(n.resources, n.path), r;
|
|
1124
|
+
},
|
|
1125
|
+
{}
|
|
1126
|
+
);
|
|
1127
|
+
};
|
|
1128
|
+
function Pe(t, e, s, r) {
|
|
1129
|
+
const n = t.split("/").filter((i) => i !== ""), o = e && n[0] === e ? n.slice(1) : n, l = Be(s, r), d = o.map((i, w) => {
|
|
1130
|
+
const m = o.slice(0, w + 1).join("/");
|
|
1131
|
+
let h = l[m];
|
|
1132
|
+
if (!h) {
|
|
1133
|
+
const v = Object.entries(l).find(
|
|
1134
|
+
([T]) => {
|
|
1135
|
+
const _ = T.split("/").map((p) => p.startsWith(":") ? "[^/]+" : p).join("/");
|
|
1136
|
+
return new RegExp(`^${_}$`).test(m);
|
|
1137
|
+
}
|
|
1138
|
+
)?.[1];
|
|
1139
|
+
v && (h = v);
|
|
1140
|
+
}
|
|
1141
|
+
let g;
|
|
1142
|
+
return h ? typeof h.breadcrumbTitle == "function" ? g = h.breadcrumbTitle(i) : typeof h.breadcrumbTitle == "string" ? g = h.breadcrumbTitle : g = h.title : g = decodeURIComponent(i), {
|
|
1143
|
+
segment: i,
|
|
1144
|
+
path: m,
|
|
1145
|
+
title: g
|
|
1146
|
+
};
|
|
1147
|
+
});
|
|
1148
|
+
return {
|
|
1149
|
+
basePath: e || null,
|
|
1150
|
+
segments: d
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
const Re = () => {
|
|
1154
|
+
const { open: t } = I();
|
|
1155
|
+
return /* @__PURE__ */ a("div", { className: t ? "astw:md:hidden" : void 0, children: /* @__PURE__ */ a(gt, { className: "astw:-ml-2.5" }) });
|
|
1156
|
+
}, Qe = (t) => {
|
|
1157
|
+
const e = t.children ? t.children({ Outlet: J }) : null, s = Gt(), r = () => {
|
|
1158
|
+
s.setTheme(s.theme === "dark" ? "light" : "dark");
|
|
1159
|
+
};
|
|
1160
|
+
return /* @__PURE__ */ a(he, { className: "astw:flex astw:flex-col", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:flex-1", children: [
|
|
1161
|
+
t.sidebar ?? /* @__PURE__ */ a(_e, {}),
|
|
1162
|
+
/* @__PURE__ */ c(ge, { className: "astw:w-[calc(100%-var(--sidebar-width))]", children: [
|
|
1163
|
+
/* @__PURE__ */ a("header", { className: "astw:flex astw:h-14 astw:shrink-0 astw:items-center astw:gap-2 astw:transition-[width,height] astw:ease-linear astw:group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ c("div", { className: "astw:flex astw:w-full astw:items-center astw:justify-between", children: [
|
|
1164
|
+
/* @__PURE__ */ c("div", { className: "astw:flex astw:items-center astw:gap-2", children: [
|
|
1165
|
+
/* @__PURE__ */ a(Re, {}),
|
|
1166
|
+
/* @__PURE__ */ a(Ie, {})
|
|
1167
|
+
] }),
|
|
1168
|
+
/* @__PURE__ */ a("div", { className: "astw:flex astw:items-center astw:gap-2", children: /* @__PURE__ */ a(B, { variant: "outline", size: "icon", onClick: r, children: /* @__PURE__ */ a(yt, {}) }) })
|
|
1169
|
+
] }) }),
|
|
1170
|
+
/* @__PURE__ */ a("div", { className: "astw:flex astw:flex-col astw:gap-4", children: e ?? /* @__PURE__ */ a(J, {}) })
|
|
1171
|
+
] })
|
|
1172
|
+
] }) });
|
|
1173
|
+
}, _e = (t) => {
|
|
1174
|
+
const { title: e, icon: s, navItems: r } = y(), { pathname: n } = it(), o = R(), l = /* @__PURE__ */ c(be, { children: [
|
|
1175
|
+
s,
|
|
1176
|
+
/* @__PURE__ */ a("h1", { className: "astw:text-sm astw:mb-2 astw:mt-2 astw:px-2", children: e })
|
|
1177
|
+
] });
|
|
1178
|
+
return /* @__PURE__ */ c(pe, { variant: "inset", children: [
|
|
1179
|
+
/* @__PURE__ */ c("div", { className: "astw:flex astw:justify-between astw:items-center", children: [
|
|
1180
|
+
t.header ?? l,
|
|
1181
|
+
/* @__PURE__ */ a("div", { className: "astw:hidden astw:md:block", children: /* @__PURE__ */ a(gt, { className: "astw:-ml-1" }) })
|
|
1182
|
+
] }),
|
|
1183
|
+
/* @__PURE__ */ a(fe, { children: /* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(xe, { children: r.map((i) => /* @__PURE__ */ a(
|
|
1184
|
+
Xt,
|
|
1185
|
+
{
|
|
1186
|
+
asChild: !0,
|
|
1187
|
+
defaultOpen: i.isActive,
|
|
1188
|
+
children: /* @__PURE__ */ c(ye, { children: [
|
|
1189
|
+
i.url ? /* @__PURE__ */ c(N, { children: [
|
|
1190
|
+
/* @__PURE__ */ a(tt, { asChild: !0, tooltip: i.title, children: /* @__PURE__ */ c(
|
|
1191
|
+
j,
|
|
1192
|
+
{
|
|
1193
|
+
to: i.url,
|
|
1194
|
+
className: i.url === n ? "astw:bg-sidebar-accent astw:font-medium" : void 0,
|
|
1195
|
+
children: [
|
|
1196
|
+
i.icon,
|
|
1197
|
+
/* @__PURE__ */ a("span", { children: i.title })
|
|
1198
|
+
]
|
|
1199
|
+
}
|
|
1200
|
+
) }),
|
|
1201
|
+
!!i.items?.length && /* @__PURE__ */ a(Z, { asChild: !0, children: /* @__PURE__ */ c(et, { className: "astw:data-[state=open]:rotate-90", children: [
|
|
1202
|
+
/* @__PURE__ */ a(D, {}),
|
|
1203
|
+
/* @__PURE__ */ a("span", { className: "astw:sr-only", children: o("toggle") })
|
|
1204
|
+
] }) })
|
|
1205
|
+
] }) : /* @__PURE__ */ a(N, { children: /* @__PURE__ */ c(Z, { className: "astw:flex astw:w-[100%] astw:[&[data-state=open]_.astw-rotate-target]:rotate-90", children: [
|
|
1206
|
+
/* @__PURE__ */ a(tt, { asChild: !0, tooltip: i.title, children: /* @__PURE__ */ c("span", { className: "astw:flex astw:w-[100%]", children: [
|
|
1207
|
+
i.icon,
|
|
1208
|
+
/* @__PURE__ */ a("span", { children: i.title })
|
|
1209
|
+
] }) }),
|
|
1210
|
+
!!i.items?.length && /* @__PURE__ */ a(
|
|
1211
|
+
et,
|
|
1212
|
+
{
|
|
1213
|
+
className: "astw-rotate-target",
|
|
1214
|
+
asChild: !0,
|
|
1215
|
+
children: /* @__PURE__ */ c("span", { children: [
|
|
1216
|
+
/* @__PURE__ */ a(D, {}),
|
|
1217
|
+
/* @__PURE__ */ a("span", { className: "astw:sr-only", children: o("toggle") })
|
|
1218
|
+
] })
|
|
1219
|
+
}
|
|
1220
|
+
)
|
|
1221
|
+
] }) }),
|
|
1222
|
+
!!i.items?.length && /* @__PURE__ */ a(Yt, { children: /* @__PURE__ */ a(Se, { children: i.items?.map((w) => /* @__PURE__ */ a(Ce, { children: /* @__PURE__ */ a(Ne, { asChild: !0, children: /* @__PURE__ */ a(
|
|
1223
|
+
j,
|
|
1224
|
+
{
|
|
1225
|
+
to: w.url,
|
|
1226
|
+
className: w.url === n ? "astw:bg-sidebar-accent astw:font-medium" : void 0,
|
|
1227
|
+
children: /* @__PURE__ */ a("span", { children: w.title })
|
|
1228
|
+
}
|
|
1229
|
+
) }) }, w.title)) }) })
|
|
1230
|
+
] })
|
|
1231
|
+
},
|
|
1232
|
+
i.title
|
|
1233
|
+
)) }) }) }),
|
|
1234
|
+
t.footer ?? null
|
|
1235
|
+
] });
|
|
1236
|
+
}, Ee = () => {
|
|
1237
|
+
const { configurations: t } = y(), e = it();
|
|
1238
|
+
return Pe(
|
|
1239
|
+
e.pathname,
|
|
1240
|
+
t.basePath,
|
|
1241
|
+
t.modules,
|
|
1242
|
+
t.locale
|
|
1243
|
+
);
|
|
1244
|
+
}, Ie = () => {
|
|
1245
|
+
const { segments: t } = Ee(), e = Et("/:prefix/settings/:suffix"), s = R();
|
|
1246
|
+
return e ? /* @__PURE__ */ a(at, { children: /* @__PURE__ */ a(st, { children: /* @__PURE__ */ a("div", { className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground", children: /* @__PURE__ */ a(rt, { children: /* @__PURE__ */ a(nt, { to: `/${e.params.prefix}/settings`, children: s("settings") }) }) }) }) }) : /* @__PURE__ */ a(at, { children: /* @__PURE__ */ a(st, { children: t.map((r, n) => /* @__PURE__ */ c(
|
|
1247
|
+
"div",
|
|
1248
|
+
{
|
|
1249
|
+
className: "astw:inline-flex astw:items-center astw:gap-3 astw:last:text-foreground",
|
|
1250
|
+
children: [
|
|
1251
|
+
/* @__PURE__ */ a(rt, { children: /* @__PURE__ */ a(nt, { to: r.path, children: r.title }) }),
|
|
1252
|
+
n < t.length - 1 && /* @__PURE__ */ a(ke, {})
|
|
1253
|
+
]
|
|
1254
|
+
},
|
|
1255
|
+
n
|
|
1256
|
+
)) }) });
|
|
1257
|
+
}, A = "oauth_pkce_verifier", L = "oauth_state", Ae = ({
|
|
1258
|
+
apiEndpoint: t,
|
|
1259
|
+
clientId: e,
|
|
1260
|
+
state: s,
|
|
1261
|
+
codeChallenge: r,
|
|
1262
|
+
redirectUri: n
|
|
1263
|
+
}) => {
|
|
1264
|
+
const o = new URL(`${t}/oauth2/authorize`);
|
|
1265
|
+
return o.searchParams.set("response_type", "code"), o.searchParams.set("client_id", e), o.searchParams.set(
|
|
1266
|
+
"redirect_uri",
|
|
1267
|
+
n ?? window.location.origin
|
|
1268
|
+
), o.searchParams.set("scope", "openid profile email"), o.searchParams.set("state", s), o.searchParams.set("code_challenge", r), o.searchParams.set("code_challenge_method", "S256"), o.toString();
|
|
1269
|
+
}, Le = async ({
|
|
1270
|
+
code: t,
|
|
1271
|
+
returnedState: e,
|
|
1272
|
+
apiEndpoint: s,
|
|
1273
|
+
clientId: r,
|
|
1274
|
+
redirectUri: n
|
|
1275
|
+
}) => {
|
|
1276
|
+
const o = sessionStorage.getItem(A), l = sessionStorage.getItem(L);
|
|
1277
|
+
if (!t || !e || !o || !l) {
|
|
1278
|
+
const i = [];
|
|
1279
|
+
throw t || i.push("code"), e || i.push("returnedState"), o || i.push("code_verifier"), l || i.push("expectedState"), new Error(`Missing params: ${i.join(", ")}`);
|
|
1280
|
+
}
|
|
1281
|
+
if (e !== l)
|
|
1282
|
+
throw new Error("State mismatch: possible CSRF attack");
|
|
1283
|
+
const d = new URLSearchParams({
|
|
1284
|
+
grant_type: "authorization_code",
|
|
1285
|
+
client_id: r,
|
|
1286
|
+
code: t,
|
|
1287
|
+
redirect_uri: n ?? window.location.origin,
|
|
1288
|
+
code_verifier: o
|
|
1289
|
+
});
|
|
1290
|
+
try {
|
|
1291
|
+
const i = await fetch(`${s}/oauth2/token`, {
|
|
1292
|
+
method: "POST",
|
|
1293
|
+
headers: {
|
|
1294
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
1295
|
+
Accept: "application/json",
|
|
1296
|
+
"X-Tailor-Nonce": crypto.randomUUID()
|
|
1297
|
+
},
|
|
1298
|
+
credentials: "include",
|
|
1299
|
+
body: d.toString()
|
|
1300
|
+
}), { access_token: w } = await i.json();
|
|
1301
|
+
return w;
|
|
1302
|
+
} catch (i) {
|
|
1303
|
+
throw new Error(
|
|
1304
|
+
`Token exchange failed: ${i instanceof Error ? i.message : String(i)}`
|
|
1305
|
+
);
|
|
1306
|
+
}
|
|
1307
|
+
}, Me = async () => {
|
|
1308
|
+
const t = M.generateRandomCodeVerifier(), e = await M.calculatePKCECodeChallenge(t), s = M.generateRandomState();
|
|
1309
|
+
return sessionStorage.setItem(A, t), sessionStorage.setItem(L, s), { codeChallenge: e, state: s };
|
|
1310
|
+
}, Je = async ({
|
|
1311
|
+
currentUrl: t,
|
|
1312
|
+
apiEndpoint: e,
|
|
1313
|
+
clientId: s,
|
|
1314
|
+
redirectUri: r
|
|
1315
|
+
}) => {
|
|
1316
|
+
try {
|
|
1317
|
+
const n = t.searchParams.get("code"), o = t.searchParams.get("state");
|
|
1318
|
+
await Le({
|
|
1319
|
+
apiEndpoint: e,
|
|
1320
|
+
clientId: s,
|
|
1321
|
+
code: n,
|
|
1322
|
+
returnedState: o,
|
|
1323
|
+
redirectUri: r
|
|
1324
|
+
});
|
|
1325
|
+
} catch (n) {
|
|
1326
|
+
console.error(n);
|
|
1327
|
+
} finally {
|
|
1328
|
+
sessionStorage.removeItem(A), sessionStorage.removeItem(L), t.searchParams.delete("code"), t.searchParams.delete("state"), t.searchParams.delete("error"), t.searchParams.delete("error_description"), window.history.replaceState({}, document.title, t.toString());
|
|
1329
|
+
}
|
|
1330
|
+
}, bt = $(void 0), Ze = () => {
|
|
1331
|
+
const t = F(bt);
|
|
1332
|
+
if (t === void 0)
|
|
1333
|
+
throw new Error(
|
|
1334
|
+
"useBuiltinIdpAuth must be used within an BuiltinIdPAuthContextProvider"
|
|
1335
|
+
);
|
|
1336
|
+
return t;
|
|
1337
|
+
}, ta = ({
|
|
1338
|
+
apiEndpoint: t,
|
|
1339
|
+
clientId: e,
|
|
1340
|
+
redirectUri: s,
|
|
1341
|
+
children: r
|
|
1342
|
+
}) => {
|
|
1343
|
+
const [n, o] = K(!1), l = Q(async () => {
|
|
1344
|
+
const { codeChallenge: i, state: w } = await Me(), m = Ae({
|
|
1345
|
+
apiEndpoint: t,
|
|
1346
|
+
clientId: e,
|
|
1347
|
+
codeChallenge: i,
|
|
1348
|
+
state: w,
|
|
1349
|
+
redirectUri: s
|
|
1350
|
+
});
|
|
1351
|
+
window.location.href = m;
|
|
1352
|
+
}, [t, e, s]);
|
|
1353
|
+
U(() => {
|
|
1354
|
+
(async () => (await (await fetch(`${t}/query`, {
|
|
1355
|
+
method: "POST",
|
|
1356
|
+
headers: {
|
|
1357
|
+
"Content-Type": "application/json",
|
|
1358
|
+
"X-Tailor-Nonce": crypto.randomUUID()
|
|
1359
|
+
},
|
|
1360
|
+
credentials: "include",
|
|
1361
|
+
// Include HTTP-only cookies
|
|
1362
|
+
body: JSON.stringify({
|
|
1363
|
+
query: "query Myself(){ me { id }}"
|
|
1364
|
+
})
|
|
1365
|
+
})).json()).data.me ? o(!0) : l())();
|
|
1366
|
+
}, [t, l]);
|
|
1367
|
+
const d = Q(async () => {
|
|
1368
|
+
sessionStorage.removeItem(A), sessionStorage.removeItem(L);
|
|
1369
|
+
try {
|
|
1370
|
+
await fetch(`${t}/oauth2/revoke`, {
|
|
1371
|
+
method: "POST",
|
|
1372
|
+
headers: {
|
|
1373
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
1374
|
+
"X-Tailor-Nonce": crypto.randomUUID()
|
|
1375
|
+
},
|
|
1376
|
+
credentials: "include",
|
|
1377
|
+
body: ""
|
|
1378
|
+
}), window.location.href = "/";
|
|
1379
|
+
} catch (i) {
|
|
1380
|
+
console.error(i);
|
|
1381
|
+
}
|
|
1382
|
+
}, [t]);
|
|
1383
|
+
return /* @__PURE__ */ a(
|
|
1384
|
+
bt.Provider,
|
|
1385
|
+
{
|
|
1386
|
+
value: H(
|
|
1387
|
+
() => ({
|
|
1388
|
+
login: l,
|
|
1389
|
+
logout: d
|
|
1390
|
+
}),
|
|
1391
|
+
[l, d]
|
|
1392
|
+
),
|
|
1393
|
+
children: n ? r : null
|
|
1394
|
+
}
|
|
1395
|
+
);
|
|
1396
|
+
};
|
|
1397
|
+
export {
|
|
1398
|
+
Ye as AppShell,
|
|
1399
|
+
ta as BuiltinIdPAuthProvider,
|
|
1400
|
+
_e as DefaultSidebar,
|
|
1401
|
+
sa as Link,
|
|
1402
|
+
L as OAUTH_STATE_KEY,
|
|
1403
|
+
A as PKCE_VERIFIER_KEY,
|
|
1404
|
+
Qe as SidebarLayout,
|
|
1405
|
+
Ae as buildAuthorizationUrl,
|
|
1406
|
+
Ot as defineI18nLabels,
|
|
1407
|
+
Ge as defineModule,
|
|
1408
|
+
Xe as defineResource,
|
|
1409
|
+
Le as exchangeCodeForToken,
|
|
1410
|
+
Je as handleOAuthCallback,
|
|
1411
|
+
Me as prepareLogin,
|
|
1412
|
+
qe as redirectToResource,
|
|
1413
|
+
y as useAppShell,
|
|
1414
|
+
Ze as useBuiltinIdpAuth,
|
|
1415
|
+
ra as useLocation,
|
|
1416
|
+
na as useNavigate,
|
|
1417
|
+
oa as useParams,
|
|
1418
|
+
ia as useRouteError,
|
|
1419
|
+
la as useSearchParams,
|
|
1420
|
+
Gt as useTheme
|
|
1421
|
+
};
|