@krak-stack/registry 0.1.1 → 0.1.3
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/README.md +17 -1
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/bubble.d.ts +16 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/marker.d.ts +10 -0
- package/dist/components/ui/message-scroller.d.ts +10 -0
- package/dist/components/ui/message.d.ts +10 -0
- package/dist/components/ui/sidebar-layout.d.ts +3 -0
- package/dist/components/ui/sidebar-layout.js +5 -0
- package/dist/lib/docs-ai.d.ts +136 -0
- package/dist/lib/docs-ai.js +310 -0
- package/dist/lib/docs-core.d.ts +681 -0
- package/dist/lib/docs-core.js +2571 -0
- package/dist/lib/httpapi-ai.d.ts +54 -0
- package/dist/lib/httpapi-ai.js +361 -0
- package/dist/lib/httpapi-cli.d.ts +22 -0
- package/dist/lib/httpapi-cli.js +412 -0
- package/dist/lib/httpapi-client.d.ts +20 -0
- package/dist/lib/httpapi-client.js +50 -0
- package/dist/lib/httpapi-helpers.d.ts +105 -0
- package/dist/lib/httpapi-helpers.js +237 -0
- package/dist/lib/httpapi-mcp.d.ts +20 -0
- package/dist/lib/httpapi-mcp.js +366 -0
- package/dist/lib/query.js +128 -0
- package/dist/services/agent/client/atom.d.ts +56 -0
- package/dist/services/agent/client/index.d.ts +2 -0
- package/dist/services/agent/client/index.js +2239 -0
- package/dist/services/agent/client/widget.d.ts +52 -0
- package/dist/services/agent/index.d.ts +111 -0
- package/dist/services/agent/index.js +190 -0
- package/dist/services/agent/schema.d.ts +161 -0
- package/dist/services/agent/schema.js +135 -0
- package/package.json +58 -2
|
@@ -0,0 +1,2571 @@
|
|
|
1
|
+
// ../../src/lib/docs-core.tsx
|
|
2
|
+
import { icons as lucideIcons } from "@iconify-json/lucide";
|
|
3
|
+
import { Icon, addCollection } from "@iconify/react";
|
|
4
|
+
import { code } from "@streamdown/code";
|
|
5
|
+
import { Link as Link3, useNavigate } from "@tanstack/react-router";
|
|
6
|
+
import { Schema as Schema2 } from "effect";
|
|
7
|
+
import {
|
|
8
|
+
Children,
|
|
9
|
+
forwardRef,
|
|
10
|
+
useDeferredValue,
|
|
11
|
+
useState as useState4
|
|
12
|
+
} from "react";
|
|
13
|
+
import { Streamdown } from "streamdown";
|
|
14
|
+
import { parse } from "yaml";
|
|
15
|
+
|
|
16
|
+
// ../../src/components/ui/app-brand.tsx
|
|
17
|
+
import { Link } from "@tanstack/react-router";
|
|
18
|
+
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
|
|
19
|
+
function AppBrand({
|
|
20
|
+
className,
|
|
21
|
+
label,
|
|
22
|
+
subtitle,
|
|
23
|
+
icon: Icon,
|
|
24
|
+
imageSrc,
|
|
25
|
+
href,
|
|
26
|
+
to,
|
|
27
|
+
variant = "default",
|
|
28
|
+
...props
|
|
29
|
+
}) {
|
|
30
|
+
const iconClassName = variant === "sidebar" ? "bg-sidebar-primary" : "bg-primary";
|
|
31
|
+
const iconColor = variant === "sidebar" ? "var(--sidebar-primary-foreground)" : "var(--primary-foreground)";
|
|
32
|
+
const contentClassName = variant === "sidebar" ? "group-data-[collapsible=icon]:hidden" : undefined;
|
|
33
|
+
const content = /* @__PURE__ */ jsxDEV(Fragment, {
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
36
|
+
className: [
|
|
37
|
+
"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md",
|
|
38
|
+
imageSrc ? "border bg-background" : iconClassName
|
|
39
|
+
].join(" "),
|
|
40
|
+
children: imageSrc ? /* @__PURE__ */ jsxDEV("img", {
|
|
41
|
+
src: imageSrc,
|
|
42
|
+
alt: label,
|
|
43
|
+
className: "size-full object-cover"
|
|
44
|
+
}, undefined, false, undefined, this) : Icon ? /* @__PURE__ */ jsxDEV(Icon, {
|
|
45
|
+
className: "size-4",
|
|
46
|
+
color: iconColor
|
|
47
|
+
}, undefined, false, undefined, this) : null
|
|
48
|
+
}, undefined, false, undefined, this),
|
|
49
|
+
/* @__PURE__ */ jsxDEV("div", {
|
|
50
|
+
className: ["flex min-w-0 flex-col leading-tight", contentClassName].filter(Boolean).join(" "),
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
53
|
+
className: "truncate font-semibold tracking-tight",
|
|
54
|
+
children: label
|
|
55
|
+
}, undefined, false, undefined, this),
|
|
56
|
+
subtitle ? /* @__PURE__ */ jsxDEV("span", {
|
|
57
|
+
className: "text-muted-foreground truncate text-xs",
|
|
58
|
+
children: subtitle
|
|
59
|
+
}, undefined, false, undefined, this) : null
|
|
60
|
+
]
|
|
61
|
+
}, undefined, true, undefined, this)
|
|
62
|
+
]
|
|
63
|
+
}, undefined, true, undefined, this);
|
|
64
|
+
const brandClassName = [
|
|
65
|
+
"flex min-w-0 items-center gap-2 text-foreground hover:text-foreground",
|
|
66
|
+
variant === "sidebar" ? "p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-0" : "",
|
|
67
|
+
className
|
|
68
|
+
].filter(Boolean).join(" ");
|
|
69
|
+
if (to === null) {
|
|
70
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
71
|
+
className: brandClassName,
|
|
72
|
+
...props,
|
|
73
|
+
children: content
|
|
74
|
+
}, undefined, false, undefined, this);
|
|
75
|
+
}
|
|
76
|
+
if (href) {
|
|
77
|
+
return /* @__PURE__ */ jsxDEV("a", {
|
|
78
|
+
className: brandClassName,
|
|
79
|
+
href,
|
|
80
|
+
...props,
|
|
81
|
+
children: content
|
|
82
|
+
}, undefined, false, undefined, this);
|
|
83
|
+
}
|
|
84
|
+
return /* @__PURE__ */ jsxDEV(Link, {
|
|
85
|
+
to: to ?? "/",
|
|
86
|
+
className: brandClassName,
|
|
87
|
+
...props,
|
|
88
|
+
children: content
|
|
89
|
+
}, undefined, false, undefined, this);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ../../src/components/ui/collapsible.tsx
|
|
93
|
+
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
|
|
94
|
+
import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
|
|
95
|
+
function Collapsible({ ...props }) {
|
|
96
|
+
return /* @__PURE__ */ jsxDEV2(CollapsiblePrimitive.Root, {
|
|
97
|
+
"data-slot": "collapsible",
|
|
98
|
+
...props
|
|
99
|
+
}, undefined, false, undefined, this);
|
|
100
|
+
}
|
|
101
|
+
function CollapsibleTrigger({ ...props }) {
|
|
102
|
+
return /* @__PURE__ */ jsxDEV2(CollapsiblePrimitive.Trigger, {
|
|
103
|
+
"data-slot": "collapsible-trigger",
|
|
104
|
+
...props
|
|
105
|
+
}, undefined, false, undefined, this);
|
|
106
|
+
}
|
|
107
|
+
function CollapsibleContent({ ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsxDEV2(CollapsiblePrimitive.Panel, {
|
|
109
|
+
"data-slot": "collapsible-content",
|
|
110
|
+
...props
|
|
111
|
+
}, undefined, false, undefined, this);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ../../src/components/ui/search-menu.tsx
|
|
115
|
+
import { SearchIcon as SearchIcon2 } from "lucide-react";
|
|
116
|
+
import { useCallback, useEffect, useState } from "react";
|
|
117
|
+
|
|
118
|
+
// ../../src/components/ui/button.tsx
|
|
119
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
120
|
+
import { cva } from "class-variance-authority";
|
|
121
|
+
|
|
122
|
+
// ../../src/lib/utils.ts
|
|
123
|
+
import { clsx } from "clsx";
|
|
124
|
+
import { twMerge } from "tailwind-merge";
|
|
125
|
+
function cn(...inputs) {
|
|
126
|
+
return twMerge(clsx(inputs));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ../../src/components/ui/button.tsx
|
|
130
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
|
131
|
+
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
132
|
+
variants: {
|
|
133
|
+
variant: {
|
|
134
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
135
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
136
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
137
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
138
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
139
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
140
|
+
},
|
|
141
|
+
size: {
|
|
142
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
143
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
144
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
145
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
146
|
+
icon: "size-9",
|
|
147
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
148
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
149
|
+
"icon-lg": "size-10"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
defaultVariants: {
|
|
153
|
+
variant: "default",
|
|
154
|
+
size: "default"
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
function Button({
|
|
158
|
+
className,
|
|
159
|
+
variant = "default",
|
|
160
|
+
size = "default",
|
|
161
|
+
...props
|
|
162
|
+
}) {
|
|
163
|
+
return /* @__PURE__ */ jsxDEV3(ButtonPrimitive, {
|
|
164
|
+
"data-slot": "button",
|
|
165
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
166
|
+
...props
|
|
167
|
+
}, undefined, false, undefined, this);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// ../../src/components/ui/command.tsx
|
|
171
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
172
|
+
import { SearchIcon } from "lucide-react";
|
|
173
|
+
|
|
174
|
+
// ../../src/components/ui/dialog.tsx
|
|
175
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
176
|
+
import { XIcon } from "lucide-react";
|
|
177
|
+
import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
|
|
178
|
+
function Dialog({ ...props }) {
|
|
179
|
+
return /* @__PURE__ */ jsxDEV4(DialogPrimitive.Root, {
|
|
180
|
+
"data-slot": "dialog",
|
|
181
|
+
...props
|
|
182
|
+
}, undefined, false, undefined, this);
|
|
183
|
+
}
|
|
184
|
+
function DialogPortal({ ...props }) {
|
|
185
|
+
return /* @__PURE__ */ jsxDEV4(DialogPrimitive.Portal, {
|
|
186
|
+
"data-slot": "dialog-portal",
|
|
187
|
+
...props
|
|
188
|
+
}, undefined, false, undefined, this);
|
|
189
|
+
}
|
|
190
|
+
function DialogOverlay({
|
|
191
|
+
className,
|
|
192
|
+
...props
|
|
193
|
+
}) {
|
|
194
|
+
return /* @__PURE__ */ jsxDEV4(DialogPrimitive.Backdrop, {
|
|
195
|
+
"data-slot": "dialog-overlay",
|
|
196
|
+
className: cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className),
|
|
197
|
+
...props
|
|
198
|
+
}, undefined, false, undefined, this);
|
|
199
|
+
}
|
|
200
|
+
function DialogContent({
|
|
201
|
+
className,
|
|
202
|
+
children,
|
|
203
|
+
...props
|
|
204
|
+
}) {
|
|
205
|
+
return /* @__PURE__ */ jsxDEV4(DialogPortal, {
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ jsxDEV4(DialogOverlay, {}, undefined, false, undefined, this),
|
|
208
|
+
/* @__PURE__ */ jsxDEV4(DialogPrimitive.Popup, {
|
|
209
|
+
"data-slot": "dialog-content",
|
|
210
|
+
className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
211
|
+
...props,
|
|
212
|
+
children: [
|
|
213
|
+
children,
|
|
214
|
+
/* @__PURE__ */ jsxDEV4(DialogPrimitive.Close, {
|
|
215
|
+
className: "focus-visible:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none",
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ jsxDEV4(XIcon, {
|
|
218
|
+
className: "size-4"
|
|
219
|
+
}, undefined, false, undefined, this),
|
|
220
|
+
/* @__PURE__ */ jsxDEV4("span", {
|
|
221
|
+
className: "sr-only",
|
|
222
|
+
children: "Close"
|
|
223
|
+
}, undefined, false, undefined, this)
|
|
224
|
+
]
|
|
225
|
+
}, undefined, true, undefined, this)
|
|
226
|
+
]
|
|
227
|
+
}, undefined, true, undefined, this)
|
|
228
|
+
]
|
|
229
|
+
}, undefined, true, undefined, this);
|
|
230
|
+
}
|
|
231
|
+
function DialogHeader({ className, ...props }) {
|
|
232
|
+
return /* @__PURE__ */ jsxDEV4("div", {
|
|
233
|
+
"data-slot": "dialog-header",
|
|
234
|
+
className: cn("grid gap-1.5", className),
|
|
235
|
+
...props
|
|
236
|
+
}, undefined, false, undefined, this);
|
|
237
|
+
}
|
|
238
|
+
function DialogTitle({
|
|
239
|
+
className,
|
|
240
|
+
...props
|
|
241
|
+
}) {
|
|
242
|
+
return /* @__PURE__ */ jsxDEV4(DialogPrimitive.Title, {
|
|
243
|
+
"data-slot": "dialog-title",
|
|
244
|
+
className: cn("text-lg font-medium", className),
|
|
245
|
+
...props
|
|
246
|
+
}, undefined, false, undefined, this);
|
|
247
|
+
}
|
|
248
|
+
function DialogDescription({
|
|
249
|
+
className,
|
|
250
|
+
...props
|
|
251
|
+
}) {
|
|
252
|
+
return /* @__PURE__ */ jsxDEV4(DialogPrimitive.Description, {
|
|
253
|
+
"data-slot": "dialog-description",
|
|
254
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
255
|
+
...props
|
|
256
|
+
}, undefined, false, undefined, this);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// ../../src/components/ui/command.tsx
|
|
260
|
+
import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
|
|
261
|
+
function Command({
|
|
262
|
+
className,
|
|
263
|
+
...props
|
|
264
|
+
}) {
|
|
265
|
+
return /* @__PURE__ */ jsxDEV5(CommandPrimitive, {
|
|
266
|
+
"data-slot": "command",
|
|
267
|
+
className: cn("flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground", className),
|
|
268
|
+
...props
|
|
269
|
+
}, undefined, false, undefined, this);
|
|
270
|
+
}
|
|
271
|
+
function CommandDialog({
|
|
272
|
+
title,
|
|
273
|
+
description,
|
|
274
|
+
children,
|
|
275
|
+
className,
|
|
276
|
+
...props
|
|
277
|
+
}) {
|
|
278
|
+
return /* @__PURE__ */ jsxDEV5(Dialog, {
|
|
279
|
+
...props,
|
|
280
|
+
children: /* @__PURE__ */ jsxDEV5(DialogContent, {
|
|
281
|
+
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl p-0", className),
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ jsxDEV5(DialogHeader, {
|
|
284
|
+
className: "sr-only",
|
|
285
|
+
children: [
|
|
286
|
+
/* @__PURE__ */ jsxDEV5(DialogTitle, {
|
|
287
|
+
children: title
|
|
288
|
+
}, undefined, false, undefined, this),
|
|
289
|
+
/* @__PURE__ */ jsxDEV5(DialogDescription, {
|
|
290
|
+
children: description
|
|
291
|
+
}, undefined, false, undefined, this)
|
|
292
|
+
]
|
|
293
|
+
}, undefined, true, undefined, this),
|
|
294
|
+
children
|
|
295
|
+
]
|
|
296
|
+
}, undefined, true, undefined, this)
|
|
297
|
+
}, undefined, false, undefined, this);
|
|
298
|
+
}
|
|
299
|
+
function CommandInput({
|
|
300
|
+
className,
|
|
301
|
+
...props
|
|
302
|
+
}) {
|
|
303
|
+
return /* @__PURE__ */ jsxDEV5("div", {
|
|
304
|
+
"data-slot": "command-input-wrapper",
|
|
305
|
+
className: "p-1 pb-0",
|
|
306
|
+
children: /* @__PURE__ */ jsxDEV5("div", {
|
|
307
|
+
className: "border-input/30 bg-input/30 flex h-9 items-center gap-2 rounded-lg border px-2 shadow-none",
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ jsxDEV5(SearchIcon, {
|
|
310
|
+
className: "size-4 shrink-0 opacity-50"
|
|
311
|
+
}, undefined, false, undefined, this),
|
|
312
|
+
/* @__PURE__ */ jsxDEV5(CommandPrimitive.Input, {
|
|
313
|
+
"data-slot": "command-input",
|
|
314
|
+
className: cn("w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
315
|
+
...props
|
|
316
|
+
}, undefined, false, undefined, this)
|
|
317
|
+
]
|
|
318
|
+
}, undefined, true, undefined, this)
|
|
319
|
+
}, undefined, false, undefined, this);
|
|
320
|
+
}
|
|
321
|
+
function CommandList({
|
|
322
|
+
className,
|
|
323
|
+
...props
|
|
324
|
+
}) {
|
|
325
|
+
return /* @__PURE__ */ jsxDEV5(CommandPrimitive.List, {
|
|
326
|
+
"data-slot": "command-list",
|
|
327
|
+
className: cn("max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
|
|
328
|
+
...props
|
|
329
|
+
}, undefined, false, undefined, this);
|
|
330
|
+
}
|
|
331
|
+
function CommandEmpty({
|
|
332
|
+
className,
|
|
333
|
+
...props
|
|
334
|
+
}) {
|
|
335
|
+
return /* @__PURE__ */ jsxDEV5(CommandPrimitive.Empty, {
|
|
336
|
+
"data-slot": "command-empty",
|
|
337
|
+
className: cn("py-6 text-center text-sm", className),
|
|
338
|
+
...props
|
|
339
|
+
}, undefined, false, undefined, this);
|
|
340
|
+
}
|
|
341
|
+
function CommandGroup({
|
|
342
|
+
className,
|
|
343
|
+
...props
|
|
344
|
+
}) {
|
|
345
|
+
return /* @__PURE__ */ jsxDEV5(CommandPrimitive.Group, {
|
|
346
|
+
"data-slot": "command-group",
|
|
347
|
+
className: cn("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", className),
|
|
348
|
+
...props
|
|
349
|
+
}, undefined, false, undefined, this);
|
|
350
|
+
}
|
|
351
|
+
function CommandItem({
|
|
352
|
+
className,
|
|
353
|
+
...props
|
|
354
|
+
}) {
|
|
355
|
+
return /* @__PURE__ */ jsxDEV5(CommandPrimitive.Item, {
|
|
356
|
+
"data-slot": "command-item",
|
|
357
|
+
className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
358
|
+
...props
|
|
359
|
+
}, undefined, false, undefined, this);
|
|
360
|
+
}
|
|
361
|
+
function CommandShortcut({
|
|
362
|
+
className,
|
|
363
|
+
...props
|
|
364
|
+
}) {
|
|
365
|
+
return /* @__PURE__ */ jsxDEV5("span", {
|
|
366
|
+
"data-slot": "command-shortcut",
|
|
367
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className),
|
|
368
|
+
...props
|
|
369
|
+
}, undefined, false, undefined, this);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// ../../src/paraglide/runtime.js
|
|
373
|
+
import"@inlang/paraglide-js/urlpattern-polyfill";
|
|
374
|
+
var baseLocale = "en";
|
|
375
|
+
var locales = ["en", "fr"];
|
|
376
|
+
var cookieName = "locale";
|
|
377
|
+
var cookieMaxAge = 34560000;
|
|
378
|
+
var cookieDomain = "";
|
|
379
|
+
var localStorageKey = "PARAGLIDE_LOCALE";
|
|
380
|
+
var strategy = [
|
|
381
|
+
"url",
|
|
382
|
+
"cookie",
|
|
383
|
+
"preferredLanguage",
|
|
384
|
+
"baseLocale"
|
|
385
|
+
];
|
|
386
|
+
var routeStrategies = [
|
|
387
|
+
{
|
|
388
|
+
match: "/api/:path(.*)?",
|
|
389
|
+
exclude: true
|
|
390
|
+
}
|
|
391
|
+
];
|
|
392
|
+
var urlPatterns = [
|
|
393
|
+
{
|
|
394
|
+
pattern: "/:path(.*)?",
|
|
395
|
+
localized: [
|
|
396
|
+
[
|
|
397
|
+
"en",
|
|
398
|
+
"/en/:path(.*)?"
|
|
399
|
+
],
|
|
400
|
+
[
|
|
401
|
+
"fr",
|
|
402
|
+
"/fr/:path(.*)?"
|
|
403
|
+
]
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
];
|
|
407
|
+
var cachedRouteStrategyUrl;
|
|
408
|
+
var cachedRouteStrategy;
|
|
409
|
+
function findMatchingRouteStrategy(url) {
|
|
410
|
+
if (routeStrategies.length === 0) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const urlString = typeof url === "string" ? url : url.href;
|
|
414
|
+
if (cachedRouteStrategyUrl === urlString) {
|
|
415
|
+
return cachedRouteStrategy;
|
|
416
|
+
}
|
|
417
|
+
const urlObject = new URL(urlString, "http://dummy.com");
|
|
418
|
+
let match;
|
|
419
|
+
for (const routeStrategy of routeStrategies) {
|
|
420
|
+
const pattern = new URLPattern(routeStrategy.match, urlObject.href);
|
|
421
|
+
if (pattern.exec(urlObject.href)) {
|
|
422
|
+
match = routeStrategy;
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
cachedRouteStrategyUrl = urlString;
|
|
427
|
+
cachedRouteStrategy = match;
|
|
428
|
+
return match;
|
|
429
|
+
}
|
|
430
|
+
function getStrategyForUrl(url) {
|
|
431
|
+
const routeStrategy = findMatchingRouteStrategy(url);
|
|
432
|
+
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
433
|
+
return routeStrategy.strategy;
|
|
434
|
+
}
|
|
435
|
+
return strategy;
|
|
436
|
+
}
|
|
437
|
+
var serverAsyncLocalStorage = undefined;
|
|
438
|
+
var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
|
|
439
|
+
var experimentalStaticLocale = undefined;
|
|
440
|
+
var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
|
|
441
|
+
var TREE_SHAKE_URL_STRATEGY_USED = true;
|
|
442
|
+
var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
|
|
443
|
+
var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
|
|
444
|
+
var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
|
|
445
|
+
var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
|
|
446
|
+
globalThis.__paraglide = globalThis.__paraglide ?? {};
|
|
447
|
+
globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
448
|
+
var _locale;
|
|
449
|
+
var localeInitiallySet = false;
|
|
450
|
+
var getLocale = () => {
|
|
451
|
+
if (experimentalStaticLocale !== undefined) {
|
|
452
|
+
return experimentalStaticLocale;
|
|
453
|
+
}
|
|
454
|
+
if (serverAsyncLocalStorage) {
|
|
455
|
+
const locale = serverAsyncLocalStorage?.getStore()?.locale;
|
|
456
|
+
if (locale) {
|
|
457
|
+
return locale;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
let strategyToUse = strategy;
|
|
461
|
+
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
462
|
+
strategyToUse = getStrategyForUrl(window.location.href);
|
|
463
|
+
}
|
|
464
|
+
const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
|
|
465
|
+
if (resolved) {
|
|
466
|
+
if (!localeInitiallySet) {
|
|
467
|
+
_locale = resolved;
|
|
468
|
+
localeInitiallySet = true;
|
|
469
|
+
setLocale(resolved, { reload: false });
|
|
470
|
+
}
|
|
471
|
+
return resolved;
|
|
472
|
+
}
|
|
473
|
+
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
474
|
+
};
|
|
475
|
+
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
476
|
+
let locale;
|
|
477
|
+
for (const strat of strategyToUse) {
|
|
478
|
+
if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
479
|
+
locale = extractLocaleFromCookie();
|
|
480
|
+
} else if (strat === "baseLocale") {
|
|
481
|
+
locale = baseLocale;
|
|
482
|
+
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
|
|
483
|
+
locale = extractLocaleFromUrl(urlForUrlStrategy);
|
|
484
|
+
} else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
|
|
485
|
+
locale = _locale;
|
|
486
|
+
} else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
|
|
487
|
+
locale = extractLocaleFromNavigator();
|
|
488
|
+
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
|
|
489
|
+
locale = localStorage.getItem(localStorageKey) ?? undefined;
|
|
490
|
+
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
491
|
+
const handler = customClientStrategies.get(strat);
|
|
492
|
+
if (handler) {
|
|
493
|
+
const result = handler.getLocale();
|
|
494
|
+
if (result instanceof Promise) {
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
if (result !== undefined) {
|
|
498
|
+
return assertIsLocale(result);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const matchedLocale = toLocale(locale);
|
|
503
|
+
if (matchedLocale) {
|
|
504
|
+
return matchedLocale;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
var rtlLanguages = new Set([
|
|
510
|
+
"ar",
|
|
511
|
+
"dv",
|
|
512
|
+
"fa",
|
|
513
|
+
"he",
|
|
514
|
+
"ks",
|
|
515
|
+
"ku",
|
|
516
|
+
"ps",
|
|
517
|
+
"sd",
|
|
518
|
+
"ug",
|
|
519
|
+
"ur",
|
|
520
|
+
"yi"
|
|
521
|
+
]);
|
|
522
|
+
var navigateOrReload = (newLocation) => {
|
|
523
|
+
if (newLocation) {
|
|
524
|
+
window.location.href = newLocation;
|
|
525
|
+
} else {
|
|
526
|
+
window.location.reload();
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
var setLocale = (newLocale, options) => {
|
|
530
|
+
const optionsWithDefaults = {
|
|
531
|
+
reload: true,
|
|
532
|
+
...options
|
|
533
|
+
};
|
|
534
|
+
let currentLocale;
|
|
535
|
+
try {
|
|
536
|
+
currentLocale = getLocale();
|
|
537
|
+
} catch {}
|
|
538
|
+
const customSetLocalePromises = [];
|
|
539
|
+
let newLocation = undefined;
|
|
540
|
+
let strategyToUse = strategy;
|
|
541
|
+
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
542
|
+
strategyToUse = getStrategyForUrl(window.location.href);
|
|
543
|
+
}
|
|
544
|
+
for (const strat of strategyToUse) {
|
|
545
|
+
if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
|
|
546
|
+
_locale = newLocale;
|
|
547
|
+
} else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
|
|
548
|
+
if (isServer || typeof document === "undefined" || typeof window === "undefined") {
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
|
|
552
|
+
document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
|
|
553
|
+
} else if (strat === "baseLocale") {
|
|
554
|
+
continue;
|
|
555
|
+
} else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
|
|
556
|
+
newLocation = localizeUrl(window.location.href, {
|
|
557
|
+
locale: newLocale
|
|
558
|
+
}).href;
|
|
559
|
+
} else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
|
|
560
|
+
localStorage.setItem(localStorageKey, newLocale);
|
|
561
|
+
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
562
|
+
const handler = customClientStrategies.get(strat);
|
|
563
|
+
if (handler) {
|
|
564
|
+
let result = handler.setLocale(newLocale);
|
|
565
|
+
if (result instanceof Promise) {
|
|
566
|
+
result = result.catch((error) => {
|
|
567
|
+
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
568
|
+
cause: error
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
customSetLocalePromises.push(result);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const runReload = () => {
|
|
577
|
+
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
578
|
+
navigateOrReload(newLocation);
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
if (customSetLocalePromises.length) {
|
|
582
|
+
return Promise.all(customSetLocalePromises).then(() => {
|
|
583
|
+
runReload();
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
runReload();
|
|
587
|
+
return;
|
|
588
|
+
};
|
|
589
|
+
var getUrlOrigin = () => {
|
|
590
|
+
if (serverAsyncLocalStorage) {
|
|
591
|
+
return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
|
|
592
|
+
} else if (typeof window !== "undefined") {
|
|
593
|
+
return window.location.origin;
|
|
594
|
+
}
|
|
595
|
+
return "http://fallback.com";
|
|
596
|
+
};
|
|
597
|
+
function toLocale(value) {
|
|
598
|
+
if (typeof value !== "string") {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const lowerValue = value.toLowerCase();
|
|
602
|
+
for (const locale of locales) {
|
|
603
|
+
if (locale.toLowerCase() === lowerValue) {
|
|
604
|
+
return locale;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
function assertIsLocale(input) {
|
|
610
|
+
const locale = toLocale(input);
|
|
611
|
+
if (locale)
|
|
612
|
+
return locale;
|
|
613
|
+
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
614
|
+
}
|
|
615
|
+
function extractLocaleFromCookie() {
|
|
616
|
+
if (typeof document === "undefined" || !document.cookie) {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
|
|
620
|
+
const locale = match?.[2];
|
|
621
|
+
return toLocale(locale);
|
|
622
|
+
}
|
|
623
|
+
function extractLocaleFromNavigator() {
|
|
624
|
+
if (!navigator?.languages?.length) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
const languages = navigator.languages.map((lang) => ({
|
|
628
|
+
fullTag: lang,
|
|
629
|
+
baseTag: lang.split("-")[0]
|
|
630
|
+
}));
|
|
631
|
+
for (const lang of languages) {
|
|
632
|
+
const fullLocale = toLocale(lang.fullTag);
|
|
633
|
+
if (fullLocale) {
|
|
634
|
+
return fullLocale;
|
|
635
|
+
}
|
|
636
|
+
const baseLocale2 = toLocale(lang.baseTag);
|
|
637
|
+
if (baseLocale2) {
|
|
638
|
+
return baseLocale2;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
var cachedUrl;
|
|
644
|
+
var cachedLocale;
|
|
645
|
+
function extractLocaleFromUrl(url) {
|
|
646
|
+
const urlString = typeof url === "string" ? url : url.href;
|
|
647
|
+
if (cachedUrl === urlString) {
|
|
648
|
+
return cachedLocale;
|
|
649
|
+
}
|
|
650
|
+
let result;
|
|
651
|
+
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
652
|
+
result = defaultUrlPatternExtractLocale(url);
|
|
653
|
+
} else {
|
|
654
|
+
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
655
|
+
for (const element of urlPatterns) {
|
|
656
|
+
for (const [locale, localizedPattern] of element.localized) {
|
|
657
|
+
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
658
|
+
if (match) {
|
|
659
|
+
result = locale;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (result)
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
cachedUrl = urlString;
|
|
668
|
+
cachedLocale = result;
|
|
669
|
+
return result;
|
|
670
|
+
}
|
|
671
|
+
function defaultUrlPatternExtractLocale(url) {
|
|
672
|
+
const urlObj = new URL(url, "http://dummy.com");
|
|
673
|
+
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
674
|
+
return toLocale(pathSegments[0]) || baseLocale;
|
|
675
|
+
}
|
|
676
|
+
function localizeUrl(url, options) {
|
|
677
|
+
const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
|
|
678
|
+
if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
|
|
679
|
+
return localizeUrlDefaultPattern(url, targetLocale);
|
|
680
|
+
}
|
|
681
|
+
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
682
|
+
for (const element of urlPatterns) {
|
|
683
|
+
for (const [, localizedPattern] of element.localized) {
|
|
684
|
+
const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
|
|
685
|
+
if (!match) {
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
689
|
+
if (!targetPattern) {
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
|
|
693
|
+
return fillMissingUrlParts(localizedUrl, match);
|
|
694
|
+
}
|
|
695
|
+
const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
|
|
696
|
+
if (unlocalizedMatch) {
|
|
697
|
+
const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
|
|
698
|
+
if (targetPattern) {
|
|
699
|
+
const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
|
|
700
|
+
return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return urlObj;
|
|
705
|
+
}
|
|
706
|
+
function localizeUrlDefaultPattern(url, locale) {
|
|
707
|
+
const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
|
|
708
|
+
const currentLocale = extractLocaleFromUrl(urlObj);
|
|
709
|
+
if (currentLocale === locale) {
|
|
710
|
+
return urlObj;
|
|
711
|
+
}
|
|
712
|
+
const pathSegments = urlObj.pathname.split("/").filter(Boolean);
|
|
713
|
+
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
714
|
+
pathSegments.shift();
|
|
715
|
+
}
|
|
716
|
+
if (locale === baseLocale) {
|
|
717
|
+
urlObj.pathname = "/" + pathSegments.join("/");
|
|
718
|
+
} else {
|
|
719
|
+
urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
|
|
720
|
+
}
|
|
721
|
+
return urlObj;
|
|
722
|
+
}
|
|
723
|
+
function fillMissingUrlParts(url, match) {
|
|
724
|
+
if (match.protocol.groups["0"]) {
|
|
725
|
+
url.protocol = match.protocol.groups["0"] ?? "";
|
|
726
|
+
}
|
|
727
|
+
if (match.hostname.groups["0"]) {
|
|
728
|
+
url.hostname = match.hostname.groups["0"] ?? "";
|
|
729
|
+
}
|
|
730
|
+
if (match.username.groups["0"]) {
|
|
731
|
+
url.username = match.username.groups["0"] ?? "";
|
|
732
|
+
}
|
|
733
|
+
if (match.password.groups["0"]) {
|
|
734
|
+
url.password = match.password.groups["0"] ?? "";
|
|
735
|
+
}
|
|
736
|
+
if (match.port.groups["0"]) {
|
|
737
|
+
url.port = match.port.groups["0"] ?? "";
|
|
738
|
+
}
|
|
739
|
+
if (match.pathname.groups["0"]) {
|
|
740
|
+
url.pathname = match.pathname.groups["0"] ?? "";
|
|
741
|
+
}
|
|
742
|
+
if (match.search.groups["0"]) {
|
|
743
|
+
url.search = match.search.groups["0"] ?? "";
|
|
744
|
+
}
|
|
745
|
+
if (match.hash.groups["0"]) {
|
|
746
|
+
url.hash = match.hash.groups["0"] ?? "";
|
|
747
|
+
}
|
|
748
|
+
return url;
|
|
749
|
+
}
|
|
750
|
+
function fillPattern(pattern, values, origin) {
|
|
751
|
+
let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
|
|
752
|
+
return `${protocol}#PORT-${port}#${slash}`;
|
|
753
|
+
});
|
|
754
|
+
let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
|
|
755
|
+
if (modifier === "?") {
|
|
756
|
+
return content;
|
|
757
|
+
}
|
|
758
|
+
return content;
|
|
759
|
+
});
|
|
760
|
+
let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
|
|
761
|
+
const value = values[name];
|
|
762
|
+
if (value === null) {
|
|
763
|
+
return "";
|
|
764
|
+
}
|
|
765
|
+
if (modifier === "?") {
|
|
766
|
+
return value !== undefined ? `${slash}${value}` : "";
|
|
767
|
+
}
|
|
768
|
+
if (modifier === "+" || modifier === "*") {
|
|
769
|
+
if (value === undefined && modifier === "+") {
|
|
770
|
+
throw new Error(`Missing value for "${name}" (one or more required)`);
|
|
771
|
+
}
|
|
772
|
+
return value ? `${slash}${value}` : "";
|
|
773
|
+
}
|
|
774
|
+
if (value === undefined) {
|
|
775
|
+
throw new Error(`Missing value for "${name}"`);
|
|
776
|
+
}
|
|
777
|
+
return `${slash}${value}`;
|
|
778
|
+
});
|
|
779
|
+
filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
|
|
780
|
+
return new URL(filled, origin);
|
|
781
|
+
}
|
|
782
|
+
function aggregateGroups(match) {
|
|
783
|
+
return {
|
|
784
|
+
...match.hash.groups,
|
|
785
|
+
...match.hostname.groups,
|
|
786
|
+
...match.password.groups,
|
|
787
|
+
...match.pathname.groups,
|
|
788
|
+
...match.port.groups,
|
|
789
|
+
...match.protocol.groups,
|
|
790
|
+
...match.search.groups,
|
|
791
|
+
...match.username.groups
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
var customServerStrategies = new Map;
|
|
795
|
+
var customClientStrategies = new Map;
|
|
796
|
+
function isCustomStrategy(strategy2) {
|
|
797
|
+
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// ../../src/components/ui/search-menu.tsx
|
|
801
|
+
import { jsxDEV as jsxDEV6, Fragment as Fragment2 } from "react/jsx-dev-runtime";
|
|
802
|
+
var messages = {
|
|
803
|
+
en: {
|
|
804
|
+
title: "Search",
|
|
805
|
+
description: "Search for an item to open.",
|
|
806
|
+
placeholder: "Search...",
|
|
807
|
+
inputPlaceholder: "Search...",
|
|
808
|
+
emptyMessage: "No results found."
|
|
809
|
+
},
|
|
810
|
+
fr: {
|
|
811
|
+
title: "Recherche",
|
|
812
|
+
description: "Recherchez un élément à ouvrir.",
|
|
813
|
+
placeholder: "Rechercher...",
|
|
814
|
+
inputPlaceholder: "Rechercher...",
|
|
815
|
+
emptyMessage: "Aucun résultat trouvé."
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
var searchMenuMessages = (overrides) => ({
|
|
819
|
+
...getLocale().startsWith("fr") ? messages.fr : messages.en,
|
|
820
|
+
...overrides
|
|
821
|
+
});
|
|
822
|
+
function SearchMenu({
|
|
823
|
+
groups,
|
|
824
|
+
title,
|
|
825
|
+
description,
|
|
826
|
+
placeholder,
|
|
827
|
+
inputPlaceholder,
|
|
828
|
+
emptyMessage,
|
|
829
|
+
messages: messages2,
|
|
830
|
+
shortcutLabel = "⌘K",
|
|
831
|
+
className,
|
|
832
|
+
open,
|
|
833
|
+
onOpenChange,
|
|
834
|
+
onSelect,
|
|
835
|
+
query,
|
|
836
|
+
onQueryChange,
|
|
837
|
+
shouldFilter
|
|
838
|
+
}) {
|
|
839
|
+
const labels = searchMenuMessages(messages2);
|
|
840
|
+
const resolvedTitle = title ?? labels.title;
|
|
841
|
+
const resolvedDescription = description ?? labels.description;
|
|
842
|
+
const resolvedPlaceholder = placeholder ?? labels.placeholder;
|
|
843
|
+
const resolvedInputPlaceholder = inputPlaceholder ?? labels.inputPlaceholder;
|
|
844
|
+
const resolvedEmptyMessage = emptyMessage ?? labels.emptyMessage;
|
|
845
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
846
|
+
const isControlled = open !== undefined;
|
|
847
|
+
const isOpen = open ?? uncontrolledOpen;
|
|
848
|
+
const setOpen = useCallback((value) => {
|
|
849
|
+
if (!isControlled)
|
|
850
|
+
setUncontrolledOpen(value);
|
|
851
|
+
onOpenChange?.(value);
|
|
852
|
+
}, [isControlled, onOpenChange]);
|
|
853
|
+
useEffect(() => {
|
|
854
|
+
const onKeyDown = (event) => {
|
|
855
|
+
if (event.key.toLowerCase() !== "k")
|
|
856
|
+
return;
|
|
857
|
+
if (!event.metaKey && !event.ctrlKey)
|
|
858
|
+
return;
|
|
859
|
+
event.preventDefault();
|
|
860
|
+
setOpen(!isOpen);
|
|
861
|
+
};
|
|
862
|
+
document.addEventListener("keydown", onKeyDown);
|
|
863
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
864
|
+
}, [isOpen, setOpen]);
|
|
865
|
+
return /* @__PURE__ */ jsxDEV6(Fragment2, {
|
|
866
|
+
children: [
|
|
867
|
+
/* @__PURE__ */ jsxDEV6(Button, {
|
|
868
|
+
"aria-label": resolvedPlaceholder,
|
|
869
|
+
type: "button",
|
|
870
|
+
variant: "outline",
|
|
871
|
+
size: "icon",
|
|
872
|
+
className: cn("sm:h-9 sm:w-64 sm:justify-start sm:gap-2.5 sm:px-2.5 sm:font-normal", className),
|
|
873
|
+
onClick: () => setOpen(true),
|
|
874
|
+
children: [
|
|
875
|
+
/* @__PURE__ */ jsxDEV6(SearchIcon2, {
|
|
876
|
+
className: "size-4 shrink-0"
|
|
877
|
+
}, undefined, false, undefined, this),
|
|
878
|
+
/* @__PURE__ */ jsxDEV6("span", {
|
|
879
|
+
className: "text-muted-foreground hidden min-w-0 flex-1 truncate text-left font-normal sm:block",
|
|
880
|
+
children: resolvedPlaceholder
|
|
881
|
+
}, undefined, false, undefined, this),
|
|
882
|
+
/* @__PURE__ */ jsxDEV6("kbd", {
|
|
883
|
+
className: "bg-muted text-muted-foreground pointer-events-none hidden h-5 items-center rounded border px-1.5 font-mono text-[10px] font-medium sm:inline-flex",
|
|
884
|
+
children: shortcutLabel
|
|
885
|
+
}, undefined, false, undefined, this)
|
|
886
|
+
]
|
|
887
|
+
}, undefined, true, undefined, this),
|
|
888
|
+
/* @__PURE__ */ jsxDEV6(CommandDialog, {
|
|
889
|
+
open: isOpen,
|
|
890
|
+
onOpenChange: setOpen,
|
|
891
|
+
title: resolvedTitle,
|
|
892
|
+
description: resolvedDescription,
|
|
893
|
+
children: /* @__PURE__ */ jsxDEV6(Command, {
|
|
894
|
+
...shouldFilter === undefined ? {} : { shouldFilter },
|
|
895
|
+
children: [
|
|
896
|
+
/* @__PURE__ */ jsxDEV6(CommandInput, {
|
|
897
|
+
placeholder: resolvedInputPlaceholder,
|
|
898
|
+
...query === undefined ? {} : { value: query },
|
|
899
|
+
...onQueryChange ? { onValueChange: onQueryChange } : {}
|
|
900
|
+
}, undefined, false, undefined, this),
|
|
901
|
+
/* @__PURE__ */ jsxDEV6(CommandList, {
|
|
902
|
+
children: [
|
|
903
|
+
/* @__PURE__ */ jsxDEV6(CommandEmpty, {
|
|
904
|
+
children: resolvedEmptyMessage
|
|
905
|
+
}, undefined, false, undefined, this),
|
|
906
|
+
groups.map((group) => /* @__PURE__ */ jsxDEV6(CommandGroup, {
|
|
907
|
+
heading: group.heading,
|
|
908
|
+
children: group.items.map((item) => /* @__PURE__ */ jsxDEV6(CommandItem, {
|
|
909
|
+
className: "data-[selected=false]:!text-foreground data-[selected=true]:bg-muted data-[selected=true]:text-foreground gap-3 py-2 data-[selected=false]:!bg-transparent",
|
|
910
|
+
value: item.label,
|
|
911
|
+
...item.keywords ? { keywords: item.keywords } : {},
|
|
912
|
+
onSelect: () => {
|
|
913
|
+
setOpen(false);
|
|
914
|
+
item.onSelect?.();
|
|
915
|
+
onSelect?.(item);
|
|
916
|
+
},
|
|
917
|
+
...item.disabled === undefined ? {} : { disabled: item.disabled },
|
|
918
|
+
children: [
|
|
919
|
+
item.icon ? /* @__PURE__ */ jsxDEV6("div", {
|
|
920
|
+
className: "text-muted-foreground bg-background group-data-[selected=true]/command-item:bg-background flex size-8 shrink-0 items-center justify-center rounded-md border",
|
|
921
|
+
children: item.icon
|
|
922
|
+
}, undefined, false, undefined, this) : null,
|
|
923
|
+
/* @__PURE__ */ jsxDEV6("div", {
|
|
924
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
925
|
+
children: [
|
|
926
|
+
/* @__PURE__ */ jsxDEV6("span", {
|
|
927
|
+
className: "truncate font-medium",
|
|
928
|
+
children: item.label
|
|
929
|
+
}, undefined, false, undefined, this),
|
|
930
|
+
item.description ? /* @__PURE__ */ jsxDEV6("span", {
|
|
931
|
+
className: "text-muted-foreground truncate text-xs",
|
|
932
|
+
children: item.description
|
|
933
|
+
}, undefined, false, undefined, this) : null
|
|
934
|
+
]
|
|
935
|
+
}, undefined, true, undefined, this),
|
|
936
|
+
item.shortcut ? /* @__PURE__ */ jsxDEV6(CommandShortcut, {
|
|
937
|
+
children: item.shortcut
|
|
938
|
+
}, undefined, false, undefined, this) : null
|
|
939
|
+
]
|
|
940
|
+
}, item.id, true, undefined, this))
|
|
941
|
+
}, group.heading, false, undefined, this))
|
|
942
|
+
]
|
|
943
|
+
}, undefined, true, undefined, this)
|
|
944
|
+
]
|
|
945
|
+
}, undefined, true, undefined, this)
|
|
946
|
+
}, undefined, false, undefined, this)
|
|
947
|
+
]
|
|
948
|
+
}, undefined, true, undefined, this);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// ../../src/components/ui/sidebar-layout.tsx
|
|
952
|
+
import { useAtom } from "@effect/atom-react";
|
|
953
|
+
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
954
|
+
import { Link as Link2, Outlet, useRouterState } from "@tanstack/react-router";
|
|
955
|
+
import { Schema } from "effect";
|
|
956
|
+
import { Atom } from "effect/unstable/reactivity";
|
|
957
|
+
|
|
958
|
+
// ../../src/components/ui/badge.tsx
|
|
959
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
960
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
961
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
962
|
+
var badgeVariants = cva2("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
963
|
+
variants: {
|
|
964
|
+
variant: {
|
|
965
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
966
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
967
|
+
destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
|
|
968
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
969
|
+
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
970
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
defaultVariants: {
|
|
974
|
+
variant: "default"
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
// ../../src/components/ui/sidebar.tsx
|
|
979
|
+
import * as React2 from "react";
|
|
980
|
+
import { mergeProps as mergeProps2 } from "@base-ui/react/merge-props";
|
|
981
|
+
import { useRender as useRender2 } from "@base-ui/react/use-render";
|
|
982
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
983
|
+
|
|
984
|
+
// ../../src/hooks/use-mobile.ts
|
|
985
|
+
import * as React from "react";
|
|
986
|
+
var MOBILE_BREAKPOINT = 768;
|
|
987
|
+
function useIsMobile() {
|
|
988
|
+
const [isMobile, setIsMobile] = React.useState(undefined);
|
|
989
|
+
React.useEffect(() => {
|
|
990
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
991
|
+
const onChange = () => {
|
|
992
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
993
|
+
};
|
|
994
|
+
mql.addEventListener("change", onChange);
|
|
995
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
996
|
+
return () => mql.removeEventListener("change", onChange);
|
|
997
|
+
}, []);
|
|
998
|
+
return !!isMobile;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// ../../src/components/ui/input.tsx
|
|
1002
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
1003
|
+
import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
|
|
1004
|
+
|
|
1005
|
+
// ../../src/components/ui/separator.tsx
|
|
1006
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
1007
|
+
import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
|
|
1008
|
+
|
|
1009
|
+
// ../../src/components/ui/sheet.tsx
|
|
1010
|
+
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
|
|
1011
|
+
import { XIcon as XIcon2 } from "lucide-react";
|
|
1012
|
+
import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
|
|
1013
|
+
"use client";
|
|
1014
|
+
function Sheet({ ...props }) {
|
|
1015
|
+
return /* @__PURE__ */ jsxDEV9(SheetPrimitive.Root, {
|
|
1016
|
+
"data-slot": "sheet",
|
|
1017
|
+
...props
|
|
1018
|
+
}, undefined, false, undefined, this);
|
|
1019
|
+
}
|
|
1020
|
+
function SheetPortal({ ...props }) {
|
|
1021
|
+
return /* @__PURE__ */ jsxDEV9(SheetPrimitive.Portal, {
|
|
1022
|
+
"data-slot": "sheet-portal",
|
|
1023
|
+
...props
|
|
1024
|
+
}, undefined, false, undefined, this);
|
|
1025
|
+
}
|
|
1026
|
+
function SheetOverlay({ className, ...props }) {
|
|
1027
|
+
return /* @__PURE__ */ jsxDEV9(SheetPrimitive.Backdrop, {
|
|
1028
|
+
"data-slot": "sheet-overlay",
|
|
1029
|
+
className: cn("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs", className),
|
|
1030
|
+
...props
|
|
1031
|
+
}, undefined, false, undefined, this);
|
|
1032
|
+
}
|
|
1033
|
+
function SheetContent({
|
|
1034
|
+
className,
|
|
1035
|
+
children,
|
|
1036
|
+
side = "right",
|
|
1037
|
+
showCloseButton = true,
|
|
1038
|
+
...props
|
|
1039
|
+
}) {
|
|
1040
|
+
return /* @__PURE__ */ jsxDEV9(SheetPortal, {
|
|
1041
|
+
children: [
|
|
1042
|
+
/* @__PURE__ */ jsxDEV9(SheetOverlay, {}, undefined, false, undefined, this),
|
|
1043
|
+
/* @__PURE__ */ jsxDEV9(SheetPrimitive.Popup, {
|
|
1044
|
+
"data-slot": "sheet-content",
|
|
1045
|
+
"data-side": side,
|
|
1046
|
+
className: cn("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", className),
|
|
1047
|
+
...props,
|
|
1048
|
+
children: [
|
|
1049
|
+
children,
|
|
1050
|
+
showCloseButton && /* @__PURE__ */ jsxDEV9(SheetPrimitive.Close, {
|
|
1051
|
+
"data-slot": "sheet-close",
|
|
1052
|
+
render: /* @__PURE__ */ jsxDEV9(Button, {
|
|
1053
|
+
variant: "ghost",
|
|
1054
|
+
className: "absolute top-4 right-4",
|
|
1055
|
+
size: "icon-sm"
|
|
1056
|
+
}, undefined, false, undefined, this),
|
|
1057
|
+
children: [
|
|
1058
|
+
/* @__PURE__ */ jsxDEV9(XIcon2, {}, undefined, false, undefined, this),
|
|
1059
|
+
/* @__PURE__ */ jsxDEV9("span", {
|
|
1060
|
+
className: "sr-only",
|
|
1061
|
+
children: "Close"
|
|
1062
|
+
}, undefined, false, undefined, this)
|
|
1063
|
+
]
|
|
1064
|
+
}, undefined, true, undefined, this)
|
|
1065
|
+
]
|
|
1066
|
+
}, undefined, true, undefined, this)
|
|
1067
|
+
]
|
|
1068
|
+
}, undefined, true, undefined, this);
|
|
1069
|
+
}
|
|
1070
|
+
function SheetHeader({ className, ...props }) {
|
|
1071
|
+
return /* @__PURE__ */ jsxDEV9("div", {
|
|
1072
|
+
"data-slot": "sheet-header",
|
|
1073
|
+
className: cn("flex flex-col gap-1.5 p-4", className),
|
|
1074
|
+
...props
|
|
1075
|
+
}, undefined, false, undefined, this);
|
|
1076
|
+
}
|
|
1077
|
+
function SheetTitle({ className, ...props }) {
|
|
1078
|
+
return /* @__PURE__ */ jsxDEV9(SheetPrimitive.Title, {
|
|
1079
|
+
"data-slot": "sheet-title",
|
|
1080
|
+
className: cn("font-medium text-foreground", className),
|
|
1081
|
+
...props
|
|
1082
|
+
}, undefined, false, undefined, this);
|
|
1083
|
+
}
|
|
1084
|
+
function SheetDescription({
|
|
1085
|
+
className,
|
|
1086
|
+
...props
|
|
1087
|
+
}) {
|
|
1088
|
+
return /* @__PURE__ */ jsxDEV9(SheetPrimitive.Description, {
|
|
1089
|
+
"data-slot": "sheet-description",
|
|
1090
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
1091
|
+
...props
|
|
1092
|
+
}, undefined, false, undefined, this);
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// ../../src/components/ui/skeleton.tsx
|
|
1096
|
+
import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
|
|
1097
|
+
|
|
1098
|
+
// ../../src/components/ui/tooltip.tsx
|
|
1099
|
+
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
1100
|
+
import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
|
|
1101
|
+
"use client";
|
|
1102
|
+
function Tooltip({ ...props }) {
|
|
1103
|
+
return /* @__PURE__ */ jsxDEV11(TooltipPrimitive.Root, {
|
|
1104
|
+
"data-slot": "tooltip",
|
|
1105
|
+
...props
|
|
1106
|
+
}, undefined, false, undefined, this);
|
|
1107
|
+
}
|
|
1108
|
+
function TooltipTrigger({ ...props }) {
|
|
1109
|
+
return /* @__PURE__ */ jsxDEV11(TooltipPrimitive.Trigger, {
|
|
1110
|
+
"data-slot": "tooltip-trigger",
|
|
1111
|
+
...props
|
|
1112
|
+
}, undefined, false, undefined, this);
|
|
1113
|
+
}
|
|
1114
|
+
function TooltipContent({
|
|
1115
|
+
className,
|
|
1116
|
+
side = "top",
|
|
1117
|
+
sideOffset = 4,
|
|
1118
|
+
align = "center",
|
|
1119
|
+
alignOffset = 0,
|
|
1120
|
+
children,
|
|
1121
|
+
...props
|
|
1122
|
+
}) {
|
|
1123
|
+
return /* @__PURE__ */ jsxDEV11(TooltipPrimitive.Portal, {
|
|
1124
|
+
children: /* @__PURE__ */ jsxDEV11(TooltipPrimitive.Positioner, {
|
|
1125
|
+
align,
|
|
1126
|
+
alignOffset,
|
|
1127
|
+
side,
|
|
1128
|
+
sideOffset,
|
|
1129
|
+
className: "isolate z-50",
|
|
1130
|
+
children: /* @__PURE__ */ jsxDEV11(TooltipPrimitive.Popup, {
|
|
1131
|
+
"data-slot": "tooltip-content",
|
|
1132
|
+
className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
|
|
1133
|
+
...props,
|
|
1134
|
+
children: [
|
|
1135
|
+
children,
|
|
1136
|
+
/* @__PURE__ */ jsxDEV11(TooltipPrimitive.Arrow, {
|
|
1137
|
+
className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"
|
|
1138
|
+
}, undefined, false, undefined, this)
|
|
1139
|
+
]
|
|
1140
|
+
}, undefined, true, undefined, this)
|
|
1141
|
+
}, undefined, false, undefined, this)
|
|
1142
|
+
}, undefined, false, undefined, this);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// ../../src/components/ui/sidebar.tsx
|
|
1146
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
1147
|
+
import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
|
|
1148
|
+
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1149
|
+
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1150
|
+
var SIDEBAR_WIDTH = "16rem";
|
|
1151
|
+
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1152
|
+
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
1153
|
+
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1154
|
+
var SidebarContext = React2.createContext(null);
|
|
1155
|
+
function useSidebar() {
|
|
1156
|
+
const context = React2.useContext(SidebarContext);
|
|
1157
|
+
if (!context) {
|
|
1158
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1159
|
+
}
|
|
1160
|
+
return context;
|
|
1161
|
+
}
|
|
1162
|
+
function SidebarProvider({
|
|
1163
|
+
defaultOpen = true,
|
|
1164
|
+
open: openProp,
|
|
1165
|
+
onOpenChange: setOpenProp,
|
|
1166
|
+
className,
|
|
1167
|
+
style,
|
|
1168
|
+
children,
|
|
1169
|
+
...props
|
|
1170
|
+
}) {
|
|
1171
|
+
const isMobile = useIsMobile();
|
|
1172
|
+
const [openMobile, setOpenMobile] = React2.useState(false);
|
|
1173
|
+
const [_open, _setOpen] = React2.useState(defaultOpen);
|
|
1174
|
+
const open = openProp ?? _open;
|
|
1175
|
+
const setOpen = React2.useCallback((value) => {
|
|
1176
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
1177
|
+
if (setOpenProp) {
|
|
1178
|
+
setOpenProp(openState);
|
|
1179
|
+
} else {
|
|
1180
|
+
_setOpen(openState);
|
|
1181
|
+
}
|
|
1182
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
1183
|
+
}, [setOpenProp, open]);
|
|
1184
|
+
const toggleSidebar = React2.useCallback(() => {
|
|
1185
|
+
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
1186
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
1187
|
+
React2.useEffect(() => {
|
|
1188
|
+
const handleKeyDown = (event) => {
|
|
1189
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1190
|
+
event.preventDefault();
|
|
1191
|
+
toggleSidebar();
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
1195
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1196
|
+
}, [toggleSidebar]);
|
|
1197
|
+
const state = open ? "expanded" : "collapsed";
|
|
1198
|
+
const contextValue = React2.useMemo(() => ({
|
|
1199
|
+
state,
|
|
1200
|
+
open,
|
|
1201
|
+
setOpen,
|
|
1202
|
+
isMobile,
|
|
1203
|
+
openMobile,
|
|
1204
|
+
setOpenMobile,
|
|
1205
|
+
toggleSidebar
|
|
1206
|
+
}), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
|
|
1207
|
+
return /* @__PURE__ */ jsxDEV12(SidebarContext.Provider, {
|
|
1208
|
+
value: contextValue,
|
|
1209
|
+
children: /* @__PURE__ */ jsxDEV12("div", {
|
|
1210
|
+
"data-slot": "sidebar-wrapper",
|
|
1211
|
+
style: {
|
|
1212
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
1213
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
1214
|
+
...style
|
|
1215
|
+
},
|
|
1216
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
1217
|
+
...props,
|
|
1218
|
+
children
|
|
1219
|
+
}, undefined, false, undefined, this)
|
|
1220
|
+
}, undefined, false, undefined, this);
|
|
1221
|
+
}
|
|
1222
|
+
function Sidebar({
|
|
1223
|
+
side = "left",
|
|
1224
|
+
variant = "sidebar",
|
|
1225
|
+
collapsible = "offcanvas",
|
|
1226
|
+
className,
|
|
1227
|
+
children,
|
|
1228
|
+
dir,
|
|
1229
|
+
...props
|
|
1230
|
+
}) {
|
|
1231
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1232
|
+
if (collapsible === "none") {
|
|
1233
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1234
|
+
"data-slot": "sidebar",
|
|
1235
|
+
className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
|
|
1236
|
+
...props,
|
|
1237
|
+
children
|
|
1238
|
+
}, undefined, false, undefined, this);
|
|
1239
|
+
}
|
|
1240
|
+
if (isMobile) {
|
|
1241
|
+
return /* @__PURE__ */ jsxDEV12(Sheet, {
|
|
1242
|
+
open: openMobile,
|
|
1243
|
+
onOpenChange: setOpenMobile,
|
|
1244
|
+
...props,
|
|
1245
|
+
children: /* @__PURE__ */ jsxDEV12(SheetContent, {
|
|
1246
|
+
dir,
|
|
1247
|
+
"data-sidebar": "sidebar",
|
|
1248
|
+
"data-slot": "sidebar",
|
|
1249
|
+
"data-mobile": "true",
|
|
1250
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
1251
|
+
style: {
|
|
1252
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
1253
|
+
},
|
|
1254
|
+
side,
|
|
1255
|
+
children: [
|
|
1256
|
+
/* @__PURE__ */ jsxDEV12(SheetHeader, {
|
|
1257
|
+
className: "sr-only",
|
|
1258
|
+
children: [
|
|
1259
|
+
/* @__PURE__ */ jsxDEV12(SheetTitle, {
|
|
1260
|
+
children: "Sidebar"
|
|
1261
|
+
}, undefined, false, undefined, this),
|
|
1262
|
+
/* @__PURE__ */ jsxDEV12(SheetDescription, {
|
|
1263
|
+
children: "Displays the mobile sidebar."
|
|
1264
|
+
}, undefined, false, undefined, this)
|
|
1265
|
+
]
|
|
1266
|
+
}, undefined, true, undefined, this),
|
|
1267
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1268
|
+
className: "flex h-full w-full flex-col",
|
|
1269
|
+
children
|
|
1270
|
+
}, undefined, false, undefined, this)
|
|
1271
|
+
]
|
|
1272
|
+
}, undefined, true, undefined, this)
|
|
1273
|
+
}, undefined, false, undefined, this);
|
|
1274
|
+
}
|
|
1275
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1276
|
+
className: "group peer text-sidebar-foreground hidden md:block",
|
|
1277
|
+
"data-state": state,
|
|
1278
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
1279
|
+
"data-variant": variant,
|
|
1280
|
+
"data-side": side,
|
|
1281
|
+
"data-slot": "sidebar",
|
|
1282
|
+
children: [
|
|
1283
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1284
|
+
"data-slot": "sidebar-gap",
|
|
1285
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
|
|
1286
|
+
}, undefined, false, undefined, this),
|
|
1287
|
+
/* @__PURE__ */ jsxDEV12("div", {
|
|
1288
|
+
"data-slot": "sidebar-container",
|
|
1289
|
+
"data-side": side,
|
|
1290
|
+
className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
|
|
1291
|
+
...props,
|
|
1292
|
+
children: /* @__PURE__ */ jsxDEV12("div", {
|
|
1293
|
+
"data-sidebar": "sidebar",
|
|
1294
|
+
"data-slot": "sidebar-inner",
|
|
1295
|
+
className: "bg-sidebar group-data-[variant=floating]:ring-sidebar-border flex size-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1",
|
|
1296
|
+
children
|
|
1297
|
+
}, undefined, false, undefined, this)
|
|
1298
|
+
}, undefined, false, undefined, this)
|
|
1299
|
+
]
|
|
1300
|
+
}, undefined, true, undefined, this);
|
|
1301
|
+
}
|
|
1302
|
+
function SidebarTrigger({
|
|
1303
|
+
className,
|
|
1304
|
+
onClick,
|
|
1305
|
+
...props
|
|
1306
|
+
}) {
|
|
1307
|
+
const { toggleSidebar } = useSidebar();
|
|
1308
|
+
return /* @__PURE__ */ jsxDEV12(Button, {
|
|
1309
|
+
"data-sidebar": "trigger",
|
|
1310
|
+
"data-slot": "sidebar-trigger",
|
|
1311
|
+
variant: "ghost",
|
|
1312
|
+
size: "icon-sm",
|
|
1313
|
+
className: cn(className),
|
|
1314
|
+
onClick: (event) => {
|
|
1315
|
+
onClick?.(event);
|
|
1316
|
+
toggleSidebar();
|
|
1317
|
+
},
|
|
1318
|
+
...props,
|
|
1319
|
+
children: [
|
|
1320
|
+
/* @__PURE__ */ jsxDEV12(PanelLeftIcon, {}, undefined, false, undefined, this),
|
|
1321
|
+
/* @__PURE__ */ jsxDEV12("span", {
|
|
1322
|
+
className: "sr-only",
|
|
1323
|
+
children: "Toggle Sidebar"
|
|
1324
|
+
}, undefined, false, undefined, this)
|
|
1325
|
+
]
|
|
1326
|
+
}, undefined, true, undefined, this);
|
|
1327
|
+
}
|
|
1328
|
+
function SidebarRail({ className, ...props }) {
|
|
1329
|
+
const { toggleSidebar } = useSidebar();
|
|
1330
|
+
return /* @__PURE__ */ jsxDEV12("button", {
|
|
1331
|
+
"data-sidebar": "rail",
|
|
1332
|
+
"data-slot": "sidebar-rail",
|
|
1333
|
+
"aria-label": "Toggle Sidebar",
|
|
1334
|
+
tabIndex: -1,
|
|
1335
|
+
onClick: toggleSidebar,
|
|
1336
|
+
title: "Toggle Sidebar",
|
|
1337
|
+
className: cn("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
1338
|
+
...props
|
|
1339
|
+
}, undefined, false, undefined, this);
|
|
1340
|
+
}
|
|
1341
|
+
function SidebarInset({ className, ...props }) {
|
|
1342
|
+
return /* @__PURE__ */ jsxDEV12("main", {
|
|
1343
|
+
"data-slot": "sidebar-inset",
|
|
1344
|
+
className: cn("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
1345
|
+
...props
|
|
1346
|
+
}, undefined, false, undefined, this);
|
|
1347
|
+
}
|
|
1348
|
+
function SidebarHeader({ className, ...props }) {
|
|
1349
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1350
|
+
"data-slot": "sidebar-header",
|
|
1351
|
+
"data-sidebar": "header",
|
|
1352
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
1353
|
+
...props
|
|
1354
|
+
}, undefined, false, undefined, this);
|
|
1355
|
+
}
|
|
1356
|
+
function SidebarFooter({ className, ...props }) {
|
|
1357
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1358
|
+
"data-slot": "sidebar-footer",
|
|
1359
|
+
"data-sidebar": "footer",
|
|
1360
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
1361
|
+
...props
|
|
1362
|
+
}, undefined, false, undefined, this);
|
|
1363
|
+
}
|
|
1364
|
+
function SidebarContent({ className, ...props }) {
|
|
1365
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1366
|
+
"data-slot": "sidebar-content",
|
|
1367
|
+
"data-sidebar": "content",
|
|
1368
|
+
className: cn("no-scrollbar flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
1369
|
+
...props
|
|
1370
|
+
}, undefined, false, undefined, this);
|
|
1371
|
+
}
|
|
1372
|
+
function SidebarGroup({ className, ...props }) {
|
|
1373
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1374
|
+
"data-slot": "sidebar-group",
|
|
1375
|
+
"data-sidebar": "group",
|
|
1376
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
1377
|
+
...props
|
|
1378
|
+
}, undefined, false, undefined, this);
|
|
1379
|
+
}
|
|
1380
|
+
function SidebarGroupLabel({
|
|
1381
|
+
className,
|
|
1382
|
+
render,
|
|
1383
|
+
...props
|
|
1384
|
+
}) {
|
|
1385
|
+
return useRender2({
|
|
1386
|
+
defaultTagName: "div",
|
|
1387
|
+
props: mergeProps2({
|
|
1388
|
+
className: cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", className)
|
|
1389
|
+
}, props),
|
|
1390
|
+
render,
|
|
1391
|
+
state: {
|
|
1392
|
+
slot: "sidebar-group-label",
|
|
1393
|
+
sidebar: "group-label"
|
|
1394
|
+
}
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
function SidebarGroupContent({
|
|
1398
|
+
className,
|
|
1399
|
+
...props
|
|
1400
|
+
}) {
|
|
1401
|
+
return /* @__PURE__ */ jsxDEV12("div", {
|
|
1402
|
+
"data-slot": "sidebar-group-content",
|
|
1403
|
+
"data-sidebar": "group-content",
|
|
1404
|
+
className: cn("w-full text-sm", className),
|
|
1405
|
+
...props
|
|
1406
|
+
}, undefined, false, undefined, this);
|
|
1407
|
+
}
|
|
1408
|
+
function SidebarMenu({ className, ...props }) {
|
|
1409
|
+
return /* @__PURE__ */ jsxDEV12("ul", {
|
|
1410
|
+
"data-slot": "sidebar-menu",
|
|
1411
|
+
"data-sidebar": "menu",
|
|
1412
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
1413
|
+
...props
|
|
1414
|
+
}, undefined, false, undefined, this);
|
|
1415
|
+
}
|
|
1416
|
+
function SidebarMenuItem({ className, ...props }) {
|
|
1417
|
+
return /* @__PURE__ */ jsxDEV12("li", {
|
|
1418
|
+
"data-slot": "sidebar-menu-item",
|
|
1419
|
+
"data-sidebar": "menu-item",
|
|
1420
|
+
className: cn("group/menu-item relative", className),
|
|
1421
|
+
...props
|
|
1422
|
+
}, undefined, false, undefined, this);
|
|
1423
|
+
}
|
|
1424
|
+
var sidebarMenuButtonVariants = cva3("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate", {
|
|
1425
|
+
variants: {
|
|
1426
|
+
variant: {
|
|
1427
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1428
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
1429
|
+
},
|
|
1430
|
+
size: {
|
|
1431
|
+
default: "h-8 text-sm",
|
|
1432
|
+
sm: "h-7 text-xs",
|
|
1433
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
defaultVariants: {
|
|
1437
|
+
variant: "default",
|
|
1438
|
+
size: "default"
|
|
1439
|
+
}
|
|
1440
|
+
});
|
|
1441
|
+
function SidebarMenuButton({
|
|
1442
|
+
render,
|
|
1443
|
+
isActive = false,
|
|
1444
|
+
variant = "default",
|
|
1445
|
+
size = "default",
|
|
1446
|
+
tooltip,
|
|
1447
|
+
className,
|
|
1448
|
+
...props
|
|
1449
|
+
}) {
|
|
1450
|
+
const { isMobile, state } = useSidebar();
|
|
1451
|
+
const comp = useRender2({
|
|
1452
|
+
defaultTagName: "button",
|
|
1453
|
+
props: mergeProps2({
|
|
1454
|
+
className: cn(sidebarMenuButtonVariants({ variant, size }), className)
|
|
1455
|
+
}, props),
|
|
1456
|
+
render: !tooltip ? render : /* @__PURE__ */ jsxDEV12(TooltipTrigger, {
|
|
1457
|
+
render
|
|
1458
|
+
}, undefined, false, undefined, this),
|
|
1459
|
+
state: {
|
|
1460
|
+
slot: "sidebar-menu-button",
|
|
1461
|
+
sidebar: "menu-button",
|
|
1462
|
+
size,
|
|
1463
|
+
active: isActive
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
if (!tooltip) {
|
|
1467
|
+
return comp;
|
|
1468
|
+
}
|
|
1469
|
+
if (typeof tooltip === "string") {
|
|
1470
|
+
tooltip = {
|
|
1471
|
+
children: tooltip
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
return /* @__PURE__ */ jsxDEV12(Tooltip, {
|
|
1475
|
+
children: [
|
|
1476
|
+
comp,
|
|
1477
|
+
/* @__PURE__ */ jsxDEV12(TooltipContent, {
|
|
1478
|
+
side: "right",
|
|
1479
|
+
align: "center",
|
|
1480
|
+
hidden: state !== "collapsed" || isMobile,
|
|
1481
|
+
...tooltip
|
|
1482
|
+
}, undefined, false, undefined, this)
|
|
1483
|
+
]
|
|
1484
|
+
}, undefined, true, undefined, this);
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
// ../../src/components/ui/sidebar-layout.tsx
|
|
1488
|
+
import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
|
|
1489
|
+
var sidebarStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
|
|
1490
|
+
var sidebarOpenAtom = Atom.kvs({
|
|
1491
|
+
runtime: sidebarStorageRuntime,
|
|
1492
|
+
key: "sidebar:open",
|
|
1493
|
+
schema: Schema.Boolean,
|
|
1494
|
+
defaultValue: () => true
|
|
1495
|
+
});
|
|
1496
|
+
function AppSidebar({ footer, groups, header }) {
|
|
1497
|
+
const { isMobile, setOpenMobile } = useSidebar();
|
|
1498
|
+
const pathname = useRouterState({
|
|
1499
|
+
select: (state) => state.location.pathname
|
|
1500
|
+
});
|
|
1501
|
+
const closeMobileSidebar = () => {
|
|
1502
|
+
if (isMobile)
|
|
1503
|
+
setOpenMobile(false);
|
|
1504
|
+
};
|
|
1505
|
+
return /* @__PURE__ */ jsxDEV13(Sidebar, {
|
|
1506
|
+
collapsible: "icon",
|
|
1507
|
+
children: [
|
|
1508
|
+
header && /* @__PURE__ */ jsxDEV13(SidebarHeader, {
|
|
1509
|
+
children: header
|
|
1510
|
+
}, undefined, false, undefined, this),
|
|
1511
|
+
/* @__PURE__ */ jsxDEV13(SidebarContent, {
|
|
1512
|
+
children: groups.map((group) => /* @__PURE__ */ jsxDEV13(SidebarGroup, {
|
|
1513
|
+
children: [
|
|
1514
|
+
/* @__PURE__ */ jsxDEV13(SidebarGroupLabel, {
|
|
1515
|
+
children: group.label()
|
|
1516
|
+
}, undefined, false, undefined, this),
|
|
1517
|
+
/* @__PURE__ */ jsxDEV13(SidebarGroupContent, {
|
|
1518
|
+
children: /* @__PURE__ */ jsxDEV13(SidebarMenu, {
|
|
1519
|
+
children: group.items.map((item) => {
|
|
1520
|
+
const render = item.external ? /* @__PURE__ */ jsxDEV13("a", {
|
|
1521
|
+
href: item.href,
|
|
1522
|
+
target: "_blank",
|
|
1523
|
+
rel: "noreferrer"
|
|
1524
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV13(Link2, {
|
|
1525
|
+
to: item.href
|
|
1526
|
+
}, undefined, false, undefined, this);
|
|
1527
|
+
return /* @__PURE__ */ jsxDEV13(SidebarMenuItem, {
|
|
1528
|
+
children: /* @__PURE__ */ jsxDEV13(SidebarMenuButton, {
|
|
1529
|
+
isActive: !item.external && pathname === item.href,
|
|
1530
|
+
onClick: closeMobileSidebar,
|
|
1531
|
+
render,
|
|
1532
|
+
tooltip: item.label(),
|
|
1533
|
+
children: [
|
|
1534
|
+
/* @__PURE__ */ jsxDEV13(item.icon, {}, undefined, false, undefined, this),
|
|
1535
|
+
/* @__PURE__ */ jsxDEV13("span", {
|
|
1536
|
+
children: item.label()
|
|
1537
|
+
}, undefined, false, undefined, this)
|
|
1538
|
+
]
|
|
1539
|
+
}, undefined, true, undefined, this)
|
|
1540
|
+
}, item.href, false, undefined, this);
|
|
1541
|
+
})
|
|
1542
|
+
}, undefined, false, undefined, this)
|
|
1543
|
+
}, undefined, false, undefined, this)
|
|
1544
|
+
]
|
|
1545
|
+
}, group.label(), true, undefined, this))
|
|
1546
|
+
}, undefined, false, undefined, this),
|
|
1547
|
+
footer ? /* @__PURE__ */ jsxDEV13(SidebarFooter, {
|
|
1548
|
+
children: footer
|
|
1549
|
+
}, undefined, false, undefined, this) : null,
|
|
1550
|
+
/* @__PURE__ */ jsxDEV13(SidebarRail, {}, undefined, false, undefined, this)
|
|
1551
|
+
]
|
|
1552
|
+
}, undefined, true, undefined, this);
|
|
1553
|
+
}
|
|
1554
|
+
function SidebarLayout({
|
|
1555
|
+
groups,
|
|
1556
|
+
children,
|
|
1557
|
+
sidebarFooter,
|
|
1558
|
+
sidebarHeader,
|
|
1559
|
+
headerActions,
|
|
1560
|
+
contentClassName,
|
|
1561
|
+
fullPage = false
|
|
1562
|
+
}) {
|
|
1563
|
+
const [sidebarOpen, setSidebarOpen] = useAtom(sidebarOpenAtom);
|
|
1564
|
+
return /* @__PURE__ */ jsxDEV13(SidebarProvider, {
|
|
1565
|
+
open: sidebarOpen,
|
|
1566
|
+
onOpenChange: setSidebarOpen,
|
|
1567
|
+
className: cn(fullPage && "xl:h-svh xl:min-h-0 xl:overflow-hidden"),
|
|
1568
|
+
children: [
|
|
1569
|
+
/* @__PURE__ */ jsxDEV13(AppSidebar, {
|
|
1570
|
+
footer: sidebarFooter,
|
|
1571
|
+
groups,
|
|
1572
|
+
header: sidebarHeader
|
|
1573
|
+
}, undefined, false, undefined, this),
|
|
1574
|
+
/* @__PURE__ */ jsxDEV13(SidebarInset, {
|
|
1575
|
+
className: cn("min-w-0 overflow-x-hidden", fullPage && "xl:h-svh xl:min-h-0 xl:overflow-hidden"),
|
|
1576
|
+
children: [
|
|
1577
|
+
/* @__PURE__ */ jsxDEV13("header", {
|
|
1578
|
+
className: "bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b px-4 backdrop-blur",
|
|
1579
|
+
children: [
|
|
1580
|
+
/* @__PURE__ */ jsxDEV13(SidebarTrigger, {}, undefined, false, undefined, this),
|
|
1581
|
+
/* @__PURE__ */ jsxDEV13("div", {
|
|
1582
|
+
className: "ml-auto flex items-center gap-2",
|
|
1583
|
+
children: headerActions
|
|
1584
|
+
}, undefined, false, undefined, this)
|
|
1585
|
+
]
|
|
1586
|
+
}, undefined, true, undefined, this),
|
|
1587
|
+
/* @__PURE__ */ jsxDEV13("div", {
|
|
1588
|
+
className: contentClassName ?? "flex flex-col gap-6 px-5 py-6 md:px-8",
|
|
1589
|
+
children: children ?? /* @__PURE__ */ jsxDEV13(Outlet, {}, undefined, false, undefined, this)
|
|
1590
|
+
}, undefined, false, undefined, this)
|
|
1591
|
+
]
|
|
1592
|
+
}, undefined, true, undefined, this)
|
|
1593
|
+
]
|
|
1594
|
+
}, undefined, true, undefined, this);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
// ../../src/lib/docs-core.tsx
|
|
1598
|
+
import { jsxDEV as jsxDEV14, Fragment as Fragment3 } from "react/jsx-dev-runtime";
|
|
1599
|
+
addCollection(lucideIcons);
|
|
1600
|
+
var DocsSection = Schema2.String.annotate({
|
|
1601
|
+
identifier: "DocsSection"
|
|
1602
|
+
});
|
|
1603
|
+
var DocsPageType = Schema2.Literals([
|
|
1604
|
+
"concept",
|
|
1605
|
+
"tutorial",
|
|
1606
|
+
"how-to",
|
|
1607
|
+
"reference",
|
|
1608
|
+
"runbook"
|
|
1609
|
+
]).annotate({ identifier: "DocsPageType" });
|
|
1610
|
+
var DocsFrontmatter = Schema2.Struct({
|
|
1611
|
+
slug: Schema2.String,
|
|
1612
|
+
path: Schema2.String,
|
|
1613
|
+
title: Schema2.String,
|
|
1614
|
+
description: Schema2.String,
|
|
1615
|
+
icon: Schema2.String,
|
|
1616
|
+
order: Schema2.Number,
|
|
1617
|
+
locale: Schema2.String,
|
|
1618
|
+
section: DocsSection,
|
|
1619
|
+
type: DocsPageType,
|
|
1620
|
+
legacySlugs: Schema2.optional(Schema2.Array(Schema2.String))
|
|
1621
|
+
}).annotate({ identifier: "DocsFrontmatter" });
|
|
1622
|
+
var DocsHeadingSchema = Schema2.Struct({
|
|
1623
|
+
depth: Schema2.Literals([2, 3]),
|
|
1624
|
+
id: Schema2.String,
|
|
1625
|
+
title: Schema2.String
|
|
1626
|
+
}).annotate({ identifier: "DocsHeading" });
|
|
1627
|
+
var DocsPageSchema = Schema2.Struct({
|
|
1628
|
+
...DocsFrontmatter.fields,
|
|
1629
|
+
headings: Schema2.Array(DocsHeadingSchema),
|
|
1630
|
+
searchText: Schema2.String,
|
|
1631
|
+
sourceFile: Schema2.String,
|
|
1632
|
+
source: Schema2.String
|
|
1633
|
+
}).annotate({ identifier: "DocsPage" });
|
|
1634
|
+
var slugifyDocsHeading = (value) => value.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[`*_~]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
1635
|
+
var stripMarkdown = (source) => source.replace(/```[\s\S]*?```/g, " ").replace(/!?(?:\[([^\]]+)\])\([^)]*\)/g, "$1").replace(/<[^>]+>/g, " ").replace(/[`*_>#|~-]/g, " ").replace(/\s+/g, " ").trim();
|
|
1636
|
+
var parseHeadings = (source, file) => {
|
|
1637
|
+
const seen = new Set;
|
|
1638
|
+
const headings = [];
|
|
1639
|
+
let fence;
|
|
1640
|
+
for (const line of source.split(/\r?\n/)) {
|
|
1641
|
+
const fenceMatch = /^\s{0,3}(```|~~~)/.exec(line)?.[1];
|
|
1642
|
+
if (fenceMatch === "```" || fenceMatch === "~~~") {
|
|
1643
|
+
if (!fence)
|
|
1644
|
+
fence = fenceMatch;
|
|
1645
|
+
else if (fence === fenceMatch)
|
|
1646
|
+
fence = undefined;
|
|
1647
|
+
continue;
|
|
1648
|
+
}
|
|
1649
|
+
if (fence)
|
|
1650
|
+
continue;
|
|
1651
|
+
const match = /^\s{0,3}(##|###)\s+(.+?)\s*#*$/.exec(line);
|
|
1652
|
+
if (!match)
|
|
1653
|
+
continue;
|
|
1654
|
+
const title = stripMarkdown(match[2] ?? "");
|
|
1655
|
+
const baseId = slugifyDocsHeading(title);
|
|
1656
|
+
if (!baseId)
|
|
1657
|
+
continue;
|
|
1658
|
+
if (seen.has(baseId)) {
|
|
1659
|
+
throw new Error(`Duplicate heading ${baseId} in ${file}`);
|
|
1660
|
+
}
|
|
1661
|
+
seen.add(baseId);
|
|
1662
|
+
headings.push({
|
|
1663
|
+
depth: match[1] === "##" ? 2 : 3,
|
|
1664
|
+
id: baseId,
|
|
1665
|
+
title
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
return headings;
|
|
1669
|
+
};
|
|
1670
|
+
var stripBodyTitle = (source) => source.replace(/^\s*#\s+.+?\r?\n+/, "");
|
|
1671
|
+
var parseDocsSource = (file, source) => {
|
|
1672
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/.exec(source);
|
|
1673
|
+
if (!match)
|
|
1674
|
+
throw new Error(`Missing frontmatter in ${file}`);
|
|
1675
|
+
const frontmatter = Schema2.decodeUnknownSync(DocsFrontmatter)(parse(match[1] ?? ""));
|
|
1676
|
+
const bodySource = match[2] ?? "";
|
|
1677
|
+
const title = /^#\s+(.+?)\s*$/m.exec(bodySource)?.[1];
|
|
1678
|
+
if (!title || stripMarkdown(title) !== stripMarkdown(frontmatter.title)) {
|
|
1679
|
+
throw new Error(`Body title does not match frontmatter in ${file}`);
|
|
1680
|
+
}
|
|
1681
|
+
const body = stripBodyTitle(bodySource);
|
|
1682
|
+
return Schema2.decodeUnknownSync(DocsPageSchema)({
|
|
1683
|
+
...frontmatter,
|
|
1684
|
+
headings: parseHeadings(body, file),
|
|
1685
|
+
searchText: stripMarkdown(body),
|
|
1686
|
+
sourceFile: file.replace(/^\.\.\//, "src/"),
|
|
1687
|
+
source: body
|
|
1688
|
+
});
|
|
1689
|
+
};
|
|
1690
|
+
var validateDocsPages = (pages, config) => {
|
|
1691
|
+
const configuredLocales = new Set(config.locales);
|
|
1692
|
+
for (const page of pages) {
|
|
1693
|
+
if (!configuredLocales.has(page.locale)) {
|
|
1694
|
+
throw new Error(`${page.sourceFile} uses unconfigured locale ${page.locale}`);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
for (const locale of config.locales) {
|
|
1698
|
+
const localized = pages.filter((page) => page.locale === locale);
|
|
1699
|
+
const slugs = new Set;
|
|
1700
|
+
const paths = new Set;
|
|
1701
|
+
const orders = new Set;
|
|
1702
|
+
const routeSlugs = new Set;
|
|
1703
|
+
for (const page of localized) {
|
|
1704
|
+
if (!/^[a-z0-9-]+:[a-z0-9-]+$/.test(page.icon)) {
|
|
1705
|
+
throw new Error(`${page.sourceFile} must use an Iconify icon name`);
|
|
1706
|
+
}
|
|
1707
|
+
if (config.matchesLocale && !config.matchesLocale(page.sourceFile, locale)) {
|
|
1708
|
+
throw new Error(`${page.sourceFile} does not match locale ${locale}`);
|
|
1709
|
+
}
|
|
1710
|
+
if (!Number.isInteger(page.order) || page.order <= 0) {
|
|
1711
|
+
throw new Error(`${page.sourceFile} must use a positive integer order`);
|
|
1712
|
+
}
|
|
1713
|
+
if (slugs.has(page.slug))
|
|
1714
|
+
throw new Error(`Duplicate ${locale} slug ${page.slug}`);
|
|
1715
|
+
if (paths.has(page.path))
|
|
1716
|
+
throw new Error(`Duplicate ${locale} path ${page.path}`);
|
|
1717
|
+
if (orders.has(page.order))
|
|
1718
|
+
throw new Error(`Duplicate ${locale} order ${page.order}`);
|
|
1719
|
+
if (routeSlugs.has(page.slug))
|
|
1720
|
+
throw new Error(`Duplicate ${locale} route slug ${page.slug}`);
|
|
1721
|
+
slugs.add(page.slug);
|
|
1722
|
+
paths.add(page.path);
|
|
1723
|
+
orders.add(page.order);
|
|
1724
|
+
routeSlugs.add(page.slug);
|
|
1725
|
+
for (const legacySlug of page.legacySlugs ?? []) {
|
|
1726
|
+
if (routeSlugs.has(legacySlug)) {
|
|
1727
|
+
throw new Error(`Duplicate ${locale} route slug ${legacySlug}`);
|
|
1728
|
+
}
|
|
1729
|
+
routeSlugs.add(legacySlug);
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
if (config.requireLocaleParity !== false && config.locales.length > 1) {
|
|
1734
|
+
const baseLocale2 = config.locales[0];
|
|
1735
|
+
const basePages = pages.filter((page) => page.locale === baseLocale2);
|
|
1736
|
+
for (const locale of config.locales.slice(1)) {
|
|
1737
|
+
const localizedBySlug = new Map(pages.filter((page) => page.locale === locale).map((page) => [page.slug, page]));
|
|
1738
|
+
for (const page of basePages) {
|
|
1739
|
+
const localized = localizedBySlug.get(page.slug);
|
|
1740
|
+
if (!localized) {
|
|
1741
|
+
throw new Error(`Missing ${locale} page for ${page.slug}`);
|
|
1742
|
+
}
|
|
1743
|
+
if (page.path !== localized.path || page.order !== localized.order || page.section !== localized.section || page.type !== localized.type || page.icon !== localized.icon || JSON.stringify(page.legacySlugs ?? []) !== JSON.stringify(localized.legacySlugs ?? [])) {
|
|
1744
|
+
throw new Error(`Metadata differs between ${baseLocale2} and ${locale} for ${page.slug}`);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
if (basePages.length !== localizedBySlug.size) {
|
|
1748
|
+
throw new Error(`${baseLocale2} and ${locale} documentation page counts differ`);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
return pages;
|
|
1753
|
+
};
|
|
1754
|
+
var createDocsSource = (config) => {
|
|
1755
|
+
if (config.locales.length === 0) {
|
|
1756
|
+
throw new Error("Documentation source requires at least one locale");
|
|
1757
|
+
}
|
|
1758
|
+
if (new Set(config.locales).size !== config.locales.length) {
|
|
1759
|
+
throw new Error("Documentation source locales must be unique");
|
|
1760
|
+
}
|
|
1761
|
+
const pages = validateDocsPages(config.pages.map((page) => Schema2.decodeUnknownSync(DocsPageSchema)(page)), config);
|
|
1762
|
+
const getPage = (slug, locale) => pages.find((page) => page.slug === slug && page.locale === locale);
|
|
1763
|
+
const resolvePage = (slug, locale) => pages.find((page) => page.locale === locale && (page.slug === slug || page.legacySlugs?.includes(slug)));
|
|
1764
|
+
const getPages = (locale) => pages.filter((page) => page.locale === locale).sort((left, right) => left.order - right.order);
|
|
1765
|
+
const getPageNeighbors = (slug, locale) => {
|
|
1766
|
+
const localized = getPages(locale);
|
|
1767
|
+
const index = localized.findIndex((page) => page.slug === slug);
|
|
1768
|
+
return {
|
|
1769
|
+
previous: index > 0 ? localized[index - 1] : undefined,
|
|
1770
|
+
next: index >= 0 && index < localized.length - 1 ? localized[index + 1] : undefined
|
|
1771
|
+
};
|
|
1772
|
+
};
|
|
1773
|
+
return {
|
|
1774
|
+
locales: config.locales,
|
|
1775
|
+
pages,
|
|
1776
|
+
getPage,
|
|
1777
|
+
getPageNeighbors,
|
|
1778
|
+
getPages,
|
|
1779
|
+
resolvePage
|
|
1780
|
+
};
|
|
1781
|
+
};
|
|
1782
|
+
var createMdxDocsSource = (config) => createDocsSource({
|
|
1783
|
+
...config,
|
|
1784
|
+
matchesLocale: config.matchesLocale ?? ((file, locale) => file.includes(`/${locale}/`)),
|
|
1785
|
+
pages: Object.entries(config.files).map(([file, source]) => parseDocsSource(file, source))
|
|
1786
|
+
});
|
|
1787
|
+
var makeDocs = (config) => {
|
|
1788
|
+
const { source } = config;
|
|
1789
|
+
const basePath = config.basePath.replace(/\/$/, "");
|
|
1790
|
+
const origin = config.origin.replace(/\/$/, "");
|
|
1791
|
+
const githubUrl = config.github?.url.replace(/\/$/, "");
|
|
1792
|
+
const brand = config.brand ?? {
|
|
1793
|
+
label: config.siteName,
|
|
1794
|
+
subtitle: () => "Documentation",
|
|
1795
|
+
icon: "lucide:book-open",
|
|
1796
|
+
href: "/"
|
|
1797
|
+
};
|
|
1798
|
+
const getMessages = (locale) => getDocsMessages(locale, config.messages?.(locale));
|
|
1799
|
+
const normalizeSearchText = (value) => value.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1800
|
+
const searchIndex = source.pages.flatMap((page) => {
|
|
1801
|
+
const description = normalizeSearchText(page.description);
|
|
1802
|
+
return [
|
|
1803
|
+
{
|
|
1804
|
+
page,
|
|
1805
|
+
title: normalizeSearchText(page.title),
|
|
1806
|
+
description,
|
|
1807
|
+
content: normalizeSearchText(page.searchText)
|
|
1808
|
+
},
|
|
1809
|
+
...page.headings.map((heading) => ({
|
|
1810
|
+
page,
|
|
1811
|
+
heading,
|
|
1812
|
+
title: normalizeSearchText(heading.title),
|
|
1813
|
+
description: `${normalizeSearchText(page.title)} ${description}`,
|
|
1814
|
+
content: ""
|
|
1815
|
+
}))
|
|
1816
|
+
];
|
|
1817
|
+
});
|
|
1818
|
+
for (const page of source.pages) {
|
|
1819
|
+
const expectedPath = page.slug === config.defaultSlug ? basePath : `${basePath}/${page.slug}`;
|
|
1820
|
+
if (page.path !== expectedPath) {
|
|
1821
|
+
throw new Error(`${page.sourceFile} must use path ${expectedPath}`);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
const pages = (locale) => source.getPages(locale);
|
|
1825
|
+
const sections = (locale) => {
|
|
1826
|
+
const localized = pages(locale);
|
|
1827
|
+
const ids = Array.from(new Set(localized.map((page) => page.section)));
|
|
1828
|
+
const configuredOrder = config.sectionOrder ?? [];
|
|
1829
|
+
const orderedIds = [
|
|
1830
|
+
...configuredOrder.filter((section) => ids.includes(section)),
|
|
1831
|
+
...ids.filter((section) => !configuredOrder.includes(section))
|
|
1832
|
+
];
|
|
1833
|
+
return orderedIds.map((id) => ({
|
|
1834
|
+
id,
|
|
1835
|
+
pages: localized.filter((page) => page.section === id)
|
|
1836
|
+
}));
|
|
1837
|
+
};
|
|
1838
|
+
const resolve = (routeSlug, locale) => {
|
|
1839
|
+
const requestedSlug = routeSlug ?? config.defaultSlug;
|
|
1840
|
+
const page = source.resolvePage(requestedSlug, locale);
|
|
1841
|
+
if (!page)
|
|
1842
|
+
return;
|
|
1843
|
+
return {
|
|
1844
|
+
page,
|
|
1845
|
+
canonical: routeSlug === undefined ? page.slug === config.defaultSlug : routeSlug === page.slug && page.slug !== config.defaultSlug,
|
|
1846
|
+
neighbors: source.getPageNeighbors(page.slug, locale)
|
|
1847
|
+
};
|
|
1848
|
+
};
|
|
1849
|
+
const search = (query, locale, options) => {
|
|
1850
|
+
const normalizedQuery = normalizeSearchText(query).trim();
|
|
1851
|
+
const limit = options?.limit ?? 20;
|
|
1852
|
+
const localized = searchIndex.filter((entry) => entry.page.locale === locale);
|
|
1853
|
+
if (!normalizedQuery) {
|
|
1854
|
+
return localized.filter((entry) => !("heading" in entry)).slice(0, limit).map(({ page }) => ({ page }));
|
|
1855
|
+
}
|
|
1856
|
+
const terms = normalizedQuery.split(/\s+/);
|
|
1857
|
+
return localized.flatMap((entry) => {
|
|
1858
|
+
let score = 0;
|
|
1859
|
+
for (const term of terms) {
|
|
1860
|
+
if (entry.title === term)
|
|
1861
|
+
score += 100;
|
|
1862
|
+
else if (entry.title.startsWith(term))
|
|
1863
|
+
score += 50;
|
|
1864
|
+
else if (entry.title.includes(term))
|
|
1865
|
+
score += 25;
|
|
1866
|
+
else if (entry.description.includes(term))
|
|
1867
|
+
score += 10;
|
|
1868
|
+
else if (entry.content.includes(term))
|
|
1869
|
+
score += 1;
|
|
1870
|
+
else
|
|
1871
|
+
return [];
|
|
1872
|
+
}
|
|
1873
|
+
if (entry.title.includes(normalizedQuery))
|
|
1874
|
+
score += 20;
|
|
1875
|
+
return [{ entry, score }];
|
|
1876
|
+
}).sort((left, right) => right.score - left.score || left.entry.page.order - right.entry.page.order).slice(0, limit).map(({ entry }) => ({
|
|
1877
|
+
page: entry.page,
|
|
1878
|
+
..."heading" in entry ? { heading: entry.heading } : {}
|
|
1879
|
+
}));
|
|
1880
|
+
};
|
|
1881
|
+
const url = (page, locale) => `${origin}/${locale}${page.path}`;
|
|
1882
|
+
const editUrl = (page) => githubUrl ? `${githubUrl}/edit/${config.github?.branch ?? "main"}/${page.sourceFile}` : undefined;
|
|
1883
|
+
const getHead = ({
|
|
1884
|
+
locale,
|
|
1885
|
+
page
|
|
1886
|
+
}) => {
|
|
1887
|
+
const resolvedMessages = getMessages(locale);
|
|
1888
|
+
const path = page?.path ?? basePath;
|
|
1889
|
+
const title = `${page?.title ?? resolvedMessages.title} | ${config.siteName}`;
|
|
1890
|
+
const description = page?.description ?? resolvedMessages.description;
|
|
1891
|
+
const canonical = page ? url(page, locale) : `${origin}/${locale}${path}`;
|
|
1892
|
+
const defaultLocale = config.defaultLocale ?? source.locales[0] ?? locale;
|
|
1893
|
+
return {
|
|
1894
|
+
meta: [
|
|
1895
|
+
{ title },
|
|
1896
|
+
{ name: "description", content: description },
|
|
1897
|
+
{ property: "og:title", content: title },
|
|
1898
|
+
{ property: "og:description", content: description },
|
|
1899
|
+
{ property: "og:type", content: "article" },
|
|
1900
|
+
{ property: "og:url", content: canonical },
|
|
1901
|
+
{ property: "og:site_name", content: config.siteName }
|
|
1902
|
+
],
|
|
1903
|
+
links: [
|
|
1904
|
+
{ rel: "canonical", href: canonical },
|
|
1905
|
+
...source.locales.map((alternateLocale) => ({
|
|
1906
|
+
rel: "alternate",
|
|
1907
|
+
hrefLang: alternateLocale,
|
|
1908
|
+
href: `${origin}/${alternateLocale}${path}`
|
|
1909
|
+
})),
|
|
1910
|
+
{
|
|
1911
|
+
rel: "alternate",
|
|
1912
|
+
hrefLang: "x-default",
|
|
1913
|
+
href: `${origin}/${defaultLocale}${path}`
|
|
1914
|
+
}
|
|
1915
|
+
]
|
|
1916
|
+
};
|
|
1917
|
+
};
|
|
1918
|
+
return {
|
|
1919
|
+
basePath,
|
|
1920
|
+
brand,
|
|
1921
|
+
defaultSlug: config.defaultSlug,
|
|
1922
|
+
editUrl,
|
|
1923
|
+
githubUrl,
|
|
1924
|
+
githubLabel: config.githubLabel ?? "GitHub",
|
|
1925
|
+
getHead,
|
|
1926
|
+
getMessages,
|
|
1927
|
+
origin,
|
|
1928
|
+
resources: config.resources,
|
|
1929
|
+
source,
|
|
1930
|
+
pages,
|
|
1931
|
+
resolve,
|
|
1932
|
+
search,
|
|
1933
|
+
sections,
|
|
1934
|
+
url
|
|
1935
|
+
};
|
|
1936
|
+
};
|
|
1937
|
+
var humanizeDocsValue = (value) => value.replaceAll("-", " ").replace(/\b\w/g, (character) => character.toUpperCase());
|
|
1938
|
+
var docsSectionMessages = {
|
|
1939
|
+
en: {
|
|
1940
|
+
start: "Getting started",
|
|
1941
|
+
integration: "Integration",
|
|
1942
|
+
frontend: "Frontend",
|
|
1943
|
+
backend: "Backend",
|
|
1944
|
+
administration: "Administration",
|
|
1945
|
+
operations: "Operations",
|
|
1946
|
+
reference: "Reference"
|
|
1947
|
+
},
|
|
1948
|
+
fr: {
|
|
1949
|
+
start: "Bien démarrer",
|
|
1950
|
+
integration: "Intégration",
|
|
1951
|
+
frontend: "Interface utilisateur",
|
|
1952
|
+
backend: "Serveur",
|
|
1953
|
+
administration: "Administration",
|
|
1954
|
+
operations: "Exploitation",
|
|
1955
|
+
reference: "Référence"
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1958
|
+
var docsPageTypeMessages = {
|
|
1959
|
+
en: {
|
|
1960
|
+
concept: "Concept",
|
|
1961
|
+
tutorial: "Tutorial",
|
|
1962
|
+
"how-to": "How-to guide",
|
|
1963
|
+
reference: "Reference",
|
|
1964
|
+
runbook: "Runbook"
|
|
1965
|
+
},
|
|
1966
|
+
fr: {
|
|
1967
|
+
concept: "Concept",
|
|
1968
|
+
tutorial: "Tutoriel",
|
|
1969
|
+
"how-to": "Guide pratique",
|
|
1970
|
+
reference: "Référence",
|
|
1971
|
+
runbook: "Procédure d’exploitation"
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
var defaultSectionLabel = (locale, section) => docsSectionMessages[locale][section] ?? humanizeDocsValue(section);
|
|
1975
|
+
var messages2 = {
|
|
1976
|
+
en: {
|
|
1977
|
+
title: "Documentation",
|
|
1978
|
+
description: "Guides and technical reference.",
|
|
1979
|
+
copied: "Copied",
|
|
1980
|
+
copyCode: "Copy code",
|
|
1981
|
+
copyLink: "Copy link",
|
|
1982
|
+
copyTable: "Copy table",
|
|
1983
|
+
downloadTable: "Download table",
|
|
1984
|
+
onThisPage: "On this page",
|
|
1985
|
+
searchTitle: "Search documentation",
|
|
1986
|
+
searchDescription: "Search documentation pages and headings.",
|
|
1987
|
+
searchPlaceholder: "Search documentation...",
|
|
1988
|
+
searchInputPlaceholder: "Search documentation...",
|
|
1989
|
+
searchEmpty: "No documentation found.",
|
|
1990
|
+
skipToContent: "Skip to content",
|
|
1991
|
+
editPage: "Edit this page",
|
|
1992
|
+
latestVersionNotice: "Documentation for the latest version.",
|
|
1993
|
+
pageNavigation: "Documentation pages",
|
|
1994
|
+
previous: "Previous",
|
|
1995
|
+
next: "Next",
|
|
1996
|
+
notFoundTitle: "Documentation page not found",
|
|
1997
|
+
notFoundDescription: "The requested documentation page does not exist or has moved.",
|
|
1998
|
+
notFoundAction: "Return to documentation",
|
|
1999
|
+
sectionLabel: (section) => defaultSectionLabel("en", section),
|
|
2000
|
+
pageTypeLabel: (type) => docsPageTypeMessages.en[type]
|
|
2001
|
+
},
|
|
2002
|
+
fr: {
|
|
2003
|
+
title: "Documentation",
|
|
2004
|
+
description: "Guides et référence technique.",
|
|
2005
|
+
copied: "Copié",
|
|
2006
|
+
copyCode: "Copier le code",
|
|
2007
|
+
copyLink: "Copier le lien",
|
|
2008
|
+
copyTable: "Copier le tableau",
|
|
2009
|
+
downloadTable: "Télécharger le tableau",
|
|
2010
|
+
onThisPage: "Sur cette page",
|
|
2011
|
+
searchTitle: "Rechercher dans la documentation",
|
|
2012
|
+
searchDescription: "Recherchez des pages et des sections dans la documentation.",
|
|
2013
|
+
searchPlaceholder: "Rechercher dans la documentation...",
|
|
2014
|
+
searchInputPlaceholder: "Rechercher dans la documentation...",
|
|
2015
|
+
searchEmpty: "Aucune documentation trouvée.",
|
|
2016
|
+
skipToContent: "Aller au contenu",
|
|
2017
|
+
editPage: "Modifier cette page",
|
|
2018
|
+
latestVersionNotice: "Documentation de la dernière version.",
|
|
2019
|
+
pageNavigation: "Pages de documentation",
|
|
2020
|
+
previous: "Précédent",
|
|
2021
|
+
next: "Suivant",
|
|
2022
|
+
notFoundTitle: "Page de documentation introuvable",
|
|
2023
|
+
notFoundDescription: "La page de documentation demandée n’existe pas ou a été déplacée.",
|
|
2024
|
+
notFoundAction: "Retourner à la documentation",
|
|
2025
|
+
sectionLabel: (section) => defaultSectionLabel("fr", section),
|
|
2026
|
+
pageTypeLabel: (type) => docsPageTypeMessages.fr[type]
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
var getDocsMessages = (locale, overrides) => ({
|
|
2030
|
+
...locale.startsWith("fr") ? messages2.fr : messages2.en,
|
|
2031
|
+
...overrides
|
|
2032
|
+
});
|
|
2033
|
+
var iconComponents = new Map;
|
|
2034
|
+
var iconFor = (name) => {
|
|
2035
|
+
const existing = iconComponents.get(name);
|
|
2036
|
+
if (existing)
|
|
2037
|
+
return existing;
|
|
2038
|
+
const DocsIcon = forwardRef(({ className, color, size }, ref) => /* @__PURE__ */ jsxDEV14(Icon, {
|
|
2039
|
+
icon: name,
|
|
2040
|
+
ref,
|
|
2041
|
+
ssr: true,
|
|
2042
|
+
...className ? { className } : {},
|
|
2043
|
+
...color ? { color } : {},
|
|
2044
|
+
...size === undefined ? {} : { height: size, width: size }
|
|
2045
|
+
}, undefined, false, undefined, this));
|
|
2046
|
+
DocsIcon.displayName = `DocsIcon(${name})`;
|
|
2047
|
+
iconComponents.set(name, DocsIcon);
|
|
2048
|
+
return DocsIcon;
|
|
2049
|
+
};
|
|
2050
|
+
var headingText = (children) => Children.toArray(children).filter((child) => ["string", "number"].includes(typeof child)).join("");
|
|
2051
|
+
var makeDocsHeading = (level, copyLink) => {
|
|
2052
|
+
const Heading = ({
|
|
2053
|
+
children,
|
|
2054
|
+
node: _node,
|
|
2055
|
+
...props
|
|
2056
|
+
}) => {
|
|
2057
|
+
const text = headingText(children);
|
|
2058
|
+
const id = slugifyDocsHeading(text);
|
|
2059
|
+
const Component = level === 2 ? "h2" : "h3";
|
|
2060
|
+
return /* @__PURE__ */ jsxDEV14(Component, {
|
|
2061
|
+
id,
|
|
2062
|
+
className: "group scroll-mt-20",
|
|
2063
|
+
...props,
|
|
2064
|
+
children: [
|
|
2065
|
+
children,
|
|
2066
|
+
/* @__PURE__ */ jsxDEV14("a", {
|
|
2067
|
+
className: "text-muted-foreground ml-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
2068
|
+
href: `#${id}`,
|
|
2069
|
+
"aria-label": `${copyLink}: ${text}`,
|
|
2070
|
+
children: "#"
|
|
2071
|
+
}, undefined, false, undefined, this)
|
|
2072
|
+
]
|
|
2073
|
+
}, undefined, true, undefined, this);
|
|
2074
|
+
};
|
|
2075
|
+
return Heading;
|
|
2076
|
+
};
|
|
2077
|
+
var DocsArticle = ({
|
|
2078
|
+
docs,
|
|
2079
|
+
messages: messages3,
|
|
2080
|
+
page
|
|
2081
|
+
}) => {
|
|
2082
|
+
const DocsLink = ({
|
|
2083
|
+
href,
|
|
2084
|
+
children,
|
|
2085
|
+
node: _node,
|
|
2086
|
+
...props
|
|
2087
|
+
}) => {
|
|
2088
|
+
if (!href)
|
|
2089
|
+
return /* @__PURE__ */ jsxDEV14("span", {
|
|
2090
|
+
children
|
|
2091
|
+
}, undefined, false, undefined, this);
|
|
2092
|
+
if (href === docs.basePath || href.startsWith(`${docs.basePath}/`)) {
|
|
2093
|
+
const [path, hash] = href.split("#", 2);
|
|
2094
|
+
return /* @__PURE__ */ jsxDEV14(Link3, {
|
|
2095
|
+
to: path,
|
|
2096
|
+
...hash ? { hash } : {},
|
|
2097
|
+
children
|
|
2098
|
+
}, undefined, false, undefined, this);
|
|
2099
|
+
}
|
|
2100
|
+
if (href.startsWith("#") || href.startsWith("/")) {
|
|
2101
|
+
return /* @__PURE__ */ jsxDEV14("a", {
|
|
2102
|
+
href,
|
|
2103
|
+
...props,
|
|
2104
|
+
children
|
|
2105
|
+
}, undefined, false, undefined, this);
|
|
2106
|
+
}
|
|
2107
|
+
return /* @__PURE__ */ jsxDEV14("a", {
|
|
2108
|
+
href,
|
|
2109
|
+
target: "_blank",
|
|
2110
|
+
rel: "noreferrer",
|
|
2111
|
+
...props,
|
|
2112
|
+
children
|
|
2113
|
+
}, undefined, false, undefined, this);
|
|
2114
|
+
};
|
|
2115
|
+
const components = {
|
|
2116
|
+
a: DocsLink,
|
|
2117
|
+
h2: makeDocsHeading(2, messages3.copyLink),
|
|
2118
|
+
h3: makeDocsHeading(3, messages3.copyLink),
|
|
2119
|
+
inlineCode: ({ children, node: _node, ...props }) => /* @__PURE__ */ jsxDEV14("code", {
|
|
2120
|
+
className: "bg-muted rounded px-1.5 py-0.5 font-mono text-[0.875em]",
|
|
2121
|
+
...props,
|
|
2122
|
+
children
|
|
2123
|
+
}, undefined, false, undefined, this),
|
|
2124
|
+
blockquote: ({ children, node: _node, ...props }) => /* @__PURE__ */ jsxDEV14("blockquote", {
|
|
2125
|
+
className: "border-primary/40 bg-muted/40 rounded-r-lg border-l-4 px-5 py-1",
|
|
2126
|
+
...props,
|
|
2127
|
+
children
|
|
2128
|
+
}, undefined, false, undefined, this)
|
|
2129
|
+
};
|
|
2130
|
+
return /* @__PURE__ */ jsxDEV14(Streamdown, {
|
|
2131
|
+
className: "[&_a:hover]:text-primary [&_a]:decoration-border text-[0.98rem] leading-7 [&_[data-streamdown=code-block-actions]]:pointer-events-auto [&_[data-streamdown=code-block-body]_code_span_span]:text-[var(--sdm-c,inherit)] dark:[&_[data-streamdown=code-block-body]_code_span_span]:text-[var(--shiki-dark,var(--sdm-c,inherit))] [&_[data-streamdown=code-block-body]_code>span]:block [&_[data-streamdown=code-block-body]_code>span]:min-w-max [&_[data-streamdown=code-block-copy-button]]:pointer-events-auto [&_[data-streamdown=code-block-header]+div]:-mt-10 [&_[data-streamdown=code-block-header]+div]:flex [&_[data-streamdown=code-block-header]+div]:h-8 [&_[data-streamdown=code-block-header]+div]:items-center [&_[data-streamdown=code-block-header]+div]:justify-end [&_a]:font-medium [&_a]:underline [&_a]:decoration-1 [&_a]:underline-offset-4 [&_a]:transition-colors [&_h2]:mt-12 [&_h2]:border-t [&_h2]:pt-8 [&_h2]:text-2xl [&_h2]:font-bold [&_h2]:tracking-tight [&_h2:first-of-type]:mt-0 [&_h2:first-of-type]:border-t-0 [&_h2:first-of-type]:pt-0 [&_h3]:mt-8 [&_h3]:text-xl [&_h3]:font-semibold [&_h3]:tracking-tight [&_ol]:my-5 [&_p]:my-5 [&_table]:text-sm [&_ul]:my-5",
|
|
2132
|
+
components,
|
|
2133
|
+
controls: {
|
|
2134
|
+
code: { copy: true, download: false },
|
|
2135
|
+
table: { copy: true, download: false, fullscreen: false }
|
|
2136
|
+
},
|
|
2137
|
+
lineNumbers: false,
|
|
2138
|
+
linkSafety: { enabled: false },
|
|
2139
|
+
mode: "static",
|
|
2140
|
+
plugins: { code },
|
|
2141
|
+
translations: {
|
|
2142
|
+
copied: messages3.copied,
|
|
2143
|
+
copyCode: messages3.copyCode,
|
|
2144
|
+
copyLink: messages3.copyLink,
|
|
2145
|
+
copyTable: messages3.copyTable,
|
|
2146
|
+
downloadTable: messages3.downloadTable
|
|
2147
|
+
},
|
|
2148
|
+
children: page.source
|
|
2149
|
+
}, undefined, false, undefined, this);
|
|
2150
|
+
};
|
|
2151
|
+
var DocsTableOfContentsItems = ({
|
|
2152
|
+
headings
|
|
2153
|
+
}) => /* @__PURE__ */ jsxDEV14("ol", {
|
|
2154
|
+
className: "border-l",
|
|
2155
|
+
children: headings.map((heading) => /* @__PURE__ */ jsxDEV14("li", {
|
|
2156
|
+
children: /* @__PURE__ */ jsxDEV14("a", {
|
|
2157
|
+
className: `text-muted-foreground hover:text-foreground block border-l border-transparent py-1.5 text-sm leading-5 ${heading.depth === 3 ? "pl-6" : "pl-4"}`,
|
|
2158
|
+
href: `#${heading.id}`,
|
|
2159
|
+
children: heading.title
|
|
2160
|
+
}, undefined, false, undefined, this)
|
|
2161
|
+
}, heading.id, false, undefined, this))
|
|
2162
|
+
}, undefined, false, undefined, this);
|
|
2163
|
+
var DocsTableOfContents = ({
|
|
2164
|
+
headings,
|
|
2165
|
+
label
|
|
2166
|
+
}) => {
|
|
2167
|
+
if (headings.length === 0)
|
|
2168
|
+
return null;
|
|
2169
|
+
return /* @__PURE__ */ jsxDEV14("nav", {
|
|
2170
|
+
"aria-label": label,
|
|
2171
|
+
className: "sticky top-20",
|
|
2172
|
+
children: [
|
|
2173
|
+
/* @__PURE__ */ jsxDEV14("p", {
|
|
2174
|
+
className: "text-foreground mb-3 text-sm font-semibold",
|
|
2175
|
+
children: label
|
|
2176
|
+
}, undefined, false, undefined, this),
|
|
2177
|
+
/* @__PURE__ */ jsxDEV14(DocsTableOfContentsItems, {
|
|
2178
|
+
headings
|
|
2179
|
+
}, undefined, false, undefined, this)
|
|
2180
|
+
]
|
|
2181
|
+
}, undefined, true, undefined, this);
|
|
2182
|
+
};
|
|
2183
|
+
var DocsMobileTableOfContents = ({
|
|
2184
|
+
headings,
|
|
2185
|
+
label
|
|
2186
|
+
}) => {
|
|
2187
|
+
if (headings.length === 0)
|
|
2188
|
+
return null;
|
|
2189
|
+
return /* @__PURE__ */ jsxDEV14(Collapsible, {
|
|
2190
|
+
className: "mb-8 overflow-hidden rounded-lg border xl:hidden",
|
|
2191
|
+
children: [
|
|
2192
|
+
/* @__PURE__ */ jsxDEV14(CollapsibleTrigger, {
|
|
2193
|
+
className: "group flex w-full cursor-pointer items-center justify-between p-4 text-left text-sm font-semibold",
|
|
2194
|
+
children: [
|
|
2195
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
2196
|
+
children: label
|
|
2197
|
+
}, undefined, false, undefined, this),
|
|
2198
|
+
/* @__PURE__ */ jsxDEV14(Icon, {
|
|
2199
|
+
className: "text-muted-foreground size-4 transition-transform group-data-[panel-open]:rotate-180",
|
|
2200
|
+
icon: "lucide:chevron-down",
|
|
2201
|
+
ssr: true
|
|
2202
|
+
}, undefined, false, undefined, this)
|
|
2203
|
+
]
|
|
2204
|
+
}, undefined, true, undefined, this),
|
|
2205
|
+
/* @__PURE__ */ jsxDEV14(CollapsibleContent, {
|
|
2206
|
+
className: "px-4 pt-1 pb-4",
|
|
2207
|
+
children: /* @__PURE__ */ jsxDEV14("nav", {
|
|
2208
|
+
"aria-label": label,
|
|
2209
|
+
children: /* @__PURE__ */ jsxDEV14(DocsTableOfContentsItems, {
|
|
2210
|
+
headings
|
|
2211
|
+
}, undefined, false, undefined, this)
|
|
2212
|
+
}, undefined, false, undefined, this)
|
|
2213
|
+
}, undefined, false, undefined, this)
|
|
2214
|
+
]
|
|
2215
|
+
}, undefined, true, undefined, this);
|
|
2216
|
+
};
|
|
2217
|
+
var DocsSearch = ({
|
|
2218
|
+
docs,
|
|
2219
|
+
locale,
|
|
2220
|
+
messages: messages3
|
|
2221
|
+
}) => {
|
|
2222
|
+
const navigate = useNavigate();
|
|
2223
|
+
const [query, setQuery] = useState4("");
|
|
2224
|
+
const deferredQuery = useDeferredValue(query);
|
|
2225
|
+
const results = docs.search(deferredQuery, locale);
|
|
2226
|
+
const isSearching = deferredQuery.trim().length > 0;
|
|
2227
|
+
const sections = isSearching ? Array.from(new Set(results.map(({ page }) => page.section))) : docs.sections(locale).map(({ id }) => id).filter((section) => results.some(({ page }) => page.section === section));
|
|
2228
|
+
const groups = sections.map((section) => {
|
|
2229
|
+
const sectionResults = results.filter(({ page }) => page.section === section);
|
|
2230
|
+
if (!isSearching) {
|
|
2231
|
+
sectionResults.sort((left, right) => {
|
|
2232
|
+
const pageOrder = left.page.order - right.page.order;
|
|
2233
|
+
if (pageOrder !== 0)
|
|
2234
|
+
return pageOrder;
|
|
2235
|
+
if (!left.heading)
|
|
2236
|
+
return -1;
|
|
2237
|
+
if (!right.heading)
|
|
2238
|
+
return 1;
|
|
2239
|
+
return left.page.headings.findIndex(({ id }) => id === left.heading?.id) - right.page.headings.findIndex(({ id }) => id === right.heading?.id);
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
return {
|
|
2243
|
+
heading: messages3.sectionLabel(section),
|
|
2244
|
+
items: sectionResults.map(({ page, heading }) => heading ? {
|
|
2245
|
+
id: `${page.path}#${heading.id}`,
|
|
2246
|
+
label: heading.title,
|
|
2247
|
+
description: page.title,
|
|
2248
|
+
icon: /* @__PURE__ */ jsxDEV14(Icon, {
|
|
2249
|
+
className: "size-4",
|
|
2250
|
+
icon: "lucide:hash",
|
|
2251
|
+
ssr: true
|
|
2252
|
+
}, undefined, false, undefined, this),
|
|
2253
|
+
onSelect: () => navigate({ to: page.path, hash: heading.id })
|
|
2254
|
+
} : {
|
|
2255
|
+
id: page.path,
|
|
2256
|
+
label: page.title,
|
|
2257
|
+
description: page.description,
|
|
2258
|
+
icon: /* @__PURE__ */ jsxDEV14(Icon, {
|
|
2259
|
+
className: "size-4",
|
|
2260
|
+
icon: page.icon,
|
|
2261
|
+
ssr: true
|
|
2262
|
+
}, undefined, false, undefined, this),
|
|
2263
|
+
onSelect: () => navigate({ to: page.path })
|
|
2264
|
+
})
|
|
2265
|
+
};
|
|
2266
|
+
});
|
|
2267
|
+
return /* @__PURE__ */ jsxDEV14(SearchMenu, {
|
|
2268
|
+
groups,
|
|
2269
|
+
messages: {
|
|
2270
|
+
title: messages3.searchTitle,
|
|
2271
|
+
description: messages3.searchDescription,
|
|
2272
|
+
placeholder: messages3.searchPlaceholder,
|
|
2273
|
+
inputPlaceholder: messages3.searchInputPlaceholder,
|
|
2274
|
+
emptyMessage: messages3.searchEmpty
|
|
2275
|
+
},
|
|
2276
|
+
query,
|
|
2277
|
+
onQueryChange: setQuery,
|
|
2278
|
+
shouldFilter: false
|
|
2279
|
+
}, undefined, false, undefined, this);
|
|
2280
|
+
};
|
|
2281
|
+
var DocsLayout = ({
|
|
2282
|
+
children,
|
|
2283
|
+
docs,
|
|
2284
|
+
headerActions,
|
|
2285
|
+
locale
|
|
2286
|
+
}) => {
|
|
2287
|
+
const { brand, resources } = docs;
|
|
2288
|
+
const resolvedMessages = docs.getMessages(locale);
|
|
2289
|
+
const groups = docs.sections(locale).map((section) => ({
|
|
2290
|
+
label: () => resolvedMessages.sectionLabel(section.id),
|
|
2291
|
+
items: section.pages.map((item) => ({
|
|
2292
|
+
label: () => item.title,
|
|
2293
|
+
href: item.path,
|
|
2294
|
+
icon: iconFor(item.icon)
|
|
2295
|
+
}))
|
|
2296
|
+
}));
|
|
2297
|
+
if (resources) {
|
|
2298
|
+
groups.push({
|
|
2299
|
+
label: resources.label,
|
|
2300
|
+
items: [
|
|
2301
|
+
...resources.items.map((item) => ({
|
|
2302
|
+
label: item.label,
|
|
2303
|
+
href: item.href,
|
|
2304
|
+
icon: iconFor(item.icon),
|
|
2305
|
+
...item.external === undefined ? {} : { external: item.external }
|
|
2306
|
+
})),
|
|
2307
|
+
...docs.githubUrl ? [
|
|
2308
|
+
{
|
|
2309
|
+
label: () => docs.githubLabel,
|
|
2310
|
+
href: docs.githubUrl,
|
|
2311
|
+
icon: iconFor("lucide:code-2"),
|
|
2312
|
+
external: true
|
|
2313
|
+
}
|
|
2314
|
+
] : []
|
|
2315
|
+
]
|
|
2316
|
+
});
|
|
2317
|
+
}
|
|
2318
|
+
return /* @__PURE__ */ jsxDEV14(SidebarLayout, {
|
|
2319
|
+
groups,
|
|
2320
|
+
sidebarHeader: /* @__PURE__ */ jsxDEV14(AppBrand, {
|
|
2321
|
+
label: brand.label,
|
|
2322
|
+
subtitle: brand.subtitle(),
|
|
2323
|
+
icon: iconFor(brand.icon),
|
|
2324
|
+
href: brand.href,
|
|
2325
|
+
variant: "sidebar"
|
|
2326
|
+
}, undefined, false, undefined, this),
|
|
2327
|
+
headerActions: /* @__PURE__ */ jsxDEV14(Fragment3, {
|
|
2328
|
+
children: [
|
|
2329
|
+
docs.githubUrl ? /* @__PURE__ */ jsxDEV14("a", {
|
|
2330
|
+
className: "text-muted-foreground hover:text-foreground hidden items-center gap-1.5 text-sm lg:flex",
|
|
2331
|
+
href: docs.githubUrl,
|
|
2332
|
+
target: "_blank",
|
|
2333
|
+
rel: "noreferrer",
|
|
2334
|
+
children: [
|
|
2335
|
+
docs.githubLabel,
|
|
2336
|
+
/* @__PURE__ */ jsxDEV14(Icon, {
|
|
2337
|
+
className: "size-3.5",
|
|
2338
|
+
icon: "lucide:external-link",
|
|
2339
|
+
ssr: true
|
|
2340
|
+
}, undefined, false, undefined, this)
|
|
2341
|
+
]
|
|
2342
|
+
}, undefined, true, undefined, this) : null,
|
|
2343
|
+
/* @__PURE__ */ jsxDEV14(DocsSearch, {
|
|
2344
|
+
docs,
|
|
2345
|
+
locale,
|
|
2346
|
+
messages: resolvedMessages
|
|
2347
|
+
}, undefined, false, undefined, this),
|
|
2348
|
+
headerActions
|
|
2349
|
+
]
|
|
2350
|
+
}, undefined, true, undefined, this),
|
|
2351
|
+
children
|
|
2352
|
+
}, undefined, false, undefined, this);
|
|
2353
|
+
};
|
|
2354
|
+
var DocsHeader = ({ docs, resolution }) => {
|
|
2355
|
+
const { page } = resolution;
|
|
2356
|
+
const resolvedMessages = docs.getMessages(page.locale);
|
|
2357
|
+
return /* @__PURE__ */ jsxDEV14("header", {
|
|
2358
|
+
className: "mb-8 border-b pb-8",
|
|
2359
|
+
children: [
|
|
2360
|
+
/* @__PURE__ */ jsxDEV14("p", {
|
|
2361
|
+
className: "text-primary mb-3 font-mono text-xs font-semibold tracking-[0.18em] uppercase",
|
|
2362
|
+
children: [
|
|
2363
|
+
resolvedMessages.sectionLabel(page.section),
|
|
2364
|
+
" ·",
|
|
2365
|
+
" ",
|
|
2366
|
+
resolvedMessages.pageTypeLabel(page.type)
|
|
2367
|
+
]
|
|
2368
|
+
}, undefined, true, undefined, this),
|
|
2369
|
+
/* @__PURE__ */ jsxDEV14("h1", {
|
|
2370
|
+
className: "text-3xl font-bold tracking-tight sm:text-4xl",
|
|
2371
|
+
children: page.title
|
|
2372
|
+
}, undefined, false, undefined, this),
|
|
2373
|
+
/* @__PURE__ */ jsxDEV14("p", {
|
|
2374
|
+
className: "text-muted-foreground mt-3 max-w-2xl text-base leading-7",
|
|
2375
|
+
children: page.description
|
|
2376
|
+
}, undefined, false, undefined, this)
|
|
2377
|
+
]
|
|
2378
|
+
}, undefined, true, undefined, this);
|
|
2379
|
+
};
|
|
2380
|
+
var DocsContent = ({ docs, resolution }) => {
|
|
2381
|
+
const { page } = resolution;
|
|
2382
|
+
const resolvedMessages = docs.getMessages(page.locale);
|
|
2383
|
+
return /* @__PURE__ */ jsxDEV14(Fragment3, {
|
|
2384
|
+
children: [
|
|
2385
|
+
/* @__PURE__ */ jsxDEV14(DocsMobileTableOfContents, {
|
|
2386
|
+
headings: page.headings,
|
|
2387
|
+
label: resolvedMessages.onThisPage
|
|
2388
|
+
}, undefined, false, undefined, this),
|
|
2389
|
+
/* @__PURE__ */ jsxDEV14(DocsArticle, {
|
|
2390
|
+
docs,
|
|
2391
|
+
messages: resolvedMessages,
|
|
2392
|
+
page
|
|
2393
|
+
}, undefined, false, undefined, this)
|
|
2394
|
+
]
|
|
2395
|
+
}, undefined, true, undefined, this);
|
|
2396
|
+
};
|
|
2397
|
+
var DocsFooter = ({ docs, resolution }) => {
|
|
2398
|
+
const { page, neighbors } = resolution;
|
|
2399
|
+
const resolvedMessages = docs.getMessages(page.locale);
|
|
2400
|
+
const editUrl = docs.editUrl(page);
|
|
2401
|
+
return /* @__PURE__ */ jsxDEV14("footer", {
|
|
2402
|
+
className: "mt-14 border-t pt-8",
|
|
2403
|
+
children: [
|
|
2404
|
+
/* @__PURE__ */ jsxDEV14("div", {
|
|
2405
|
+
className: "mb-8 flex flex-wrap items-center justify-between gap-4 text-sm",
|
|
2406
|
+
children: [
|
|
2407
|
+
editUrl ? /* @__PURE__ */ jsxDEV14("a", {
|
|
2408
|
+
className: "text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5",
|
|
2409
|
+
href: editUrl,
|
|
2410
|
+
target: "_blank",
|
|
2411
|
+
rel: "noreferrer",
|
|
2412
|
+
children: [
|
|
2413
|
+
resolvedMessages.editPage,
|
|
2414
|
+
/* @__PURE__ */ jsxDEV14(Icon, {
|
|
2415
|
+
className: "size-3.5",
|
|
2416
|
+
icon: "lucide:external-link",
|
|
2417
|
+
ssr: true
|
|
2418
|
+
}, undefined, false, undefined, this)
|
|
2419
|
+
]
|
|
2420
|
+
}, undefined, true, undefined, this) : null,
|
|
2421
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
2422
|
+
className: "text-muted-foreground",
|
|
2423
|
+
children: resolvedMessages.latestVersionNotice
|
|
2424
|
+
}, undefined, false, undefined, this)
|
|
2425
|
+
]
|
|
2426
|
+
}, undefined, true, undefined, this),
|
|
2427
|
+
/* @__PURE__ */ jsxDEV14("nav", {
|
|
2428
|
+
"aria-label": resolvedMessages.pageNavigation,
|
|
2429
|
+
className: "grid gap-3 sm:grid-cols-2",
|
|
2430
|
+
children: [
|
|
2431
|
+
neighbors.previous ? /* @__PURE__ */ jsxDEV14(Link3, {
|
|
2432
|
+
className: "hover:bg-muted/50 rounded-lg border p-4 transition-colors",
|
|
2433
|
+
to: neighbors.previous.path,
|
|
2434
|
+
children: [
|
|
2435
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
2436
|
+
className: "text-muted-foreground flex items-center gap-1 text-xs font-medium uppercase",
|
|
2437
|
+
children: [
|
|
2438
|
+
/* @__PURE__ */ jsxDEV14(Icon, {
|
|
2439
|
+
className: "size-3.5",
|
|
2440
|
+
icon: "lucide:arrow-left",
|
|
2441
|
+
ssr: true
|
|
2442
|
+
}, undefined, false, undefined, this),
|
|
2443
|
+
resolvedMessages.previous
|
|
2444
|
+
]
|
|
2445
|
+
}, undefined, true, undefined, this),
|
|
2446
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
2447
|
+
className: "mt-1 block font-semibold",
|
|
2448
|
+
children: neighbors.previous.title
|
|
2449
|
+
}, undefined, false, undefined, this)
|
|
2450
|
+
]
|
|
2451
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV14("span", {}, undefined, false, undefined, this),
|
|
2452
|
+
neighbors.next ? /* @__PURE__ */ jsxDEV14(Link3, {
|
|
2453
|
+
className: "hover:bg-muted/50 rounded-lg border p-4 text-right transition-colors",
|
|
2454
|
+
to: neighbors.next.path,
|
|
2455
|
+
children: [
|
|
2456
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
2457
|
+
className: "text-muted-foreground flex items-center justify-end gap-1 text-xs font-medium uppercase",
|
|
2458
|
+
children: [
|
|
2459
|
+
resolvedMessages.next,
|
|
2460
|
+
/* @__PURE__ */ jsxDEV14(Icon, {
|
|
2461
|
+
className: "size-3.5",
|
|
2462
|
+
icon: "lucide:arrow-right",
|
|
2463
|
+
ssr: true
|
|
2464
|
+
}, undefined, false, undefined, this)
|
|
2465
|
+
]
|
|
2466
|
+
}, undefined, true, undefined, this),
|
|
2467
|
+
/* @__PURE__ */ jsxDEV14("span", {
|
|
2468
|
+
className: "mt-1 block font-semibold",
|
|
2469
|
+
children: neighbors.next.title
|
|
2470
|
+
}, undefined, false, undefined, this)
|
|
2471
|
+
]
|
|
2472
|
+
}, undefined, true, undefined, this) : null
|
|
2473
|
+
]
|
|
2474
|
+
}, undefined, true, undefined, this)
|
|
2475
|
+
]
|
|
2476
|
+
}, undefined, true, undefined, this);
|
|
2477
|
+
};
|
|
2478
|
+
var DocsPage = ({ children, docs, resolution }) => {
|
|
2479
|
+
const { page } = resolution;
|
|
2480
|
+
const resolvedMessages = docs.getMessages(page.locale);
|
|
2481
|
+
const content = children ?? /* @__PURE__ */ jsxDEV14(Fragment3, {
|
|
2482
|
+
children: [
|
|
2483
|
+
/* @__PURE__ */ jsxDEV14(DocsHeader, {
|
|
2484
|
+
docs,
|
|
2485
|
+
resolution
|
|
2486
|
+
}, undefined, false, undefined, this),
|
|
2487
|
+
/* @__PURE__ */ jsxDEV14(DocsContent, {
|
|
2488
|
+
docs,
|
|
2489
|
+
resolution
|
|
2490
|
+
}, undefined, false, undefined, this),
|
|
2491
|
+
/* @__PURE__ */ jsxDEV14(DocsFooter, {
|
|
2492
|
+
docs,
|
|
2493
|
+
resolution
|
|
2494
|
+
}, undefined, false, undefined, this)
|
|
2495
|
+
]
|
|
2496
|
+
}, undefined, true, undefined, this);
|
|
2497
|
+
return /* @__PURE__ */ jsxDEV14(Fragment3, {
|
|
2498
|
+
children: [
|
|
2499
|
+
/* @__PURE__ */ jsxDEV14("a", {
|
|
2500
|
+
className: "bg-background focus:ring-ring fixed top-2 left-2 z-50 -translate-y-20 rounded-md border px-3 py-2 text-sm shadow-sm focus:translate-y-0 focus:ring-2",
|
|
2501
|
+
href: "#docs-content",
|
|
2502
|
+
children: resolvedMessages.skipToContent
|
|
2503
|
+
}, undefined, false, undefined, this),
|
|
2504
|
+
/* @__PURE__ */ jsxDEV14("div", {
|
|
2505
|
+
className: "mx-auto grid w-full max-w-6xl gap-10 xl:grid-cols-[minmax(0,48rem)_14rem]",
|
|
2506
|
+
children: [
|
|
2507
|
+
/* @__PURE__ */ jsxDEV14("article", {
|
|
2508
|
+
id: "docs-content",
|
|
2509
|
+
className: "min-w-0 pb-16",
|
|
2510
|
+
tabIndex: -1,
|
|
2511
|
+
children: content
|
|
2512
|
+
}, undefined, false, undefined, this),
|
|
2513
|
+
/* @__PURE__ */ jsxDEV14("aside", {
|
|
2514
|
+
className: "hidden xl:block",
|
|
2515
|
+
children: /* @__PURE__ */ jsxDEV14(DocsTableOfContents, {
|
|
2516
|
+
headings: page.headings,
|
|
2517
|
+
label: resolvedMessages.onThisPage
|
|
2518
|
+
}, undefined, false, undefined, this)
|
|
2519
|
+
}, undefined, false, undefined, this)
|
|
2520
|
+
]
|
|
2521
|
+
}, undefined, true, undefined, this)
|
|
2522
|
+
]
|
|
2523
|
+
}, undefined, true, undefined, this);
|
|
2524
|
+
};
|
|
2525
|
+
var DocsNotFound = ({
|
|
2526
|
+
docs,
|
|
2527
|
+
locale
|
|
2528
|
+
}) => {
|
|
2529
|
+
const resolvedMessages = docs.getMessages(locale);
|
|
2530
|
+
return /* @__PURE__ */ jsxDEV14("main", {
|
|
2531
|
+
className: "mx-auto flex min-h-screen max-w-lg flex-col justify-center px-6 text-center",
|
|
2532
|
+
children: [
|
|
2533
|
+
/* @__PURE__ */ jsxDEV14(Icon, {
|
|
2534
|
+
className: "text-primary mx-auto size-10",
|
|
2535
|
+
icon: docs.brand.icon,
|
|
2536
|
+
ssr: true
|
|
2537
|
+
}, undefined, false, undefined, this),
|
|
2538
|
+
/* @__PURE__ */ jsxDEV14("h1", {
|
|
2539
|
+
className: "mt-6 text-3xl font-bold tracking-tight",
|
|
2540
|
+
children: resolvedMessages.notFoundTitle
|
|
2541
|
+
}, undefined, false, undefined, this),
|
|
2542
|
+
/* @__PURE__ */ jsxDEV14("p", {
|
|
2543
|
+
className: "text-muted-foreground mt-3 leading-7",
|
|
2544
|
+
children: resolvedMessages.notFoundDescription
|
|
2545
|
+
}, undefined, false, undefined, this),
|
|
2546
|
+
/* @__PURE__ */ jsxDEV14(Link3, {
|
|
2547
|
+
className: "text-primary mt-6 font-semibold underline underline-offset-4",
|
|
2548
|
+
to: docs.basePath,
|
|
2549
|
+
children: resolvedMessages.notFoundAction
|
|
2550
|
+
}, undefined, false, undefined, this)
|
|
2551
|
+
]
|
|
2552
|
+
}, undefined, true, undefined, this);
|
|
2553
|
+
};
|
|
2554
|
+
export {
|
|
2555
|
+
slugifyDocsHeading,
|
|
2556
|
+
makeDocs,
|
|
2557
|
+
getDocsMessages,
|
|
2558
|
+
createMdxDocsSource,
|
|
2559
|
+
createDocsSource,
|
|
2560
|
+
DocsSection,
|
|
2561
|
+
DocsPageType,
|
|
2562
|
+
DocsPageSchema,
|
|
2563
|
+
DocsPage,
|
|
2564
|
+
DocsNotFound,
|
|
2565
|
+
DocsLayout,
|
|
2566
|
+
DocsHeadingSchema,
|
|
2567
|
+
DocsHeader,
|
|
2568
|
+
DocsFrontmatter,
|
|
2569
|
+
DocsFooter,
|
|
2570
|
+
DocsContent
|
|
2571
|
+
};
|