@krak-stack/registry 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +29 -0
  2. package/dist/components/ui/alert-dialog.d.ts +18 -0
  3. package/dist/components/ui/app-brand.d.ts +26 -0
  4. package/dist/components/ui/app-brand.js +78 -0
  5. package/dist/components/ui/attachment.d.ts +23 -0
  6. package/dist/components/ui/badge.d.ts +7 -0
  7. package/dist/components/ui/button.d.ts +8 -0
  8. package/dist/components/ui/card.d.ts +11 -0
  9. package/dist/components/ui/checkbox.d.ts +3 -0
  10. package/dist/components/ui/code-block.d.ts +14 -0
  11. package/dist/components/ui/code-block.js +224 -0
  12. package/dist/components/ui/command.d.ts +18 -0
  13. package/dist/components/ui/copy-button.d.ts +18 -0
  14. package/dist/components/ui/copy-button.js +133 -0
  15. package/dist/components/ui/data-table.d.ts +264 -0
  16. package/dist/components/ui/data-table.js +3594 -0
  17. package/dist/components/ui/dialog.d.ts +13 -0
  18. package/dist/components/ui/dropdown-menu.d.ts +29 -0
  19. package/dist/components/ui/editing-locale-switcher.d.ts +7 -0
  20. package/dist/components/ui/editing-locale-switcher.js +626 -0
  21. package/dist/components/ui/effect-form.d.ts +137 -0
  22. package/dist/components/ui/effect-form.js +2330 -0
  23. package/dist/components/ui/field.d.ts +24 -0
  24. package/dist/components/ui/file-picker.d.ts +30 -0
  25. package/dist/components/ui/file-picker.js +811 -0
  26. package/dist/components/ui/form.d.ts +402 -0
  27. package/dist/components/ui/form.js +2245 -0
  28. package/dist/components/ui/google-map.d.ts +103 -0
  29. package/dist/components/ui/google-map.js +754 -0
  30. package/dist/components/ui/icon-input.d.ts +9 -0
  31. package/dist/components/ui/icon-input.js +971 -0
  32. package/dist/components/ui/input-group.d.ts +17 -0
  33. package/dist/components/ui/input.d.ts +3 -0
  34. package/dist/components/ui/label.d.ts +3 -0
  35. package/dist/components/ui/loading.d.ts +7 -0
  36. package/dist/components/ui/loading.js +467 -0
  37. package/dist/components/ui/locale-switcher.d.ts +7 -0
  38. package/dist/components/ui/locale-switcher.js +632 -0
  39. package/dist/components/ui/pagination.d.ts +43 -0
  40. package/dist/components/ui/pagination.js +787 -0
  41. package/dist/components/ui/popover.d.ts +9 -0
  42. package/dist/components/ui/scroll-area.d.ts +4 -0
  43. package/dist/components/ui/search-menu.d.ts +34 -0
  44. package/dist/components/ui/search-menu.js +839 -0
  45. package/dist/components/ui/select.d.ts +15 -0
  46. package/dist/components/ui/separator.d.ts +3 -0
  47. package/dist/components/ui/sheet.d.ts +14 -0
  48. package/dist/components/ui/sidebar-layout.d.ts +29 -0
  49. package/dist/components/ui/sidebar-layout.js +755 -0
  50. package/dist/components/ui/sidebar.d.ts +63 -0
  51. package/dist/components/ui/skeleton.d.ts +2 -0
  52. package/dist/components/ui/stats-card.d.ts +12 -0
  53. package/dist/components/ui/stats-card.js +125 -0
  54. package/dist/components/ui/table.d.ts +10 -0
  55. package/dist/components/ui/textarea.d.ts +3 -0
  56. package/dist/components/ui/theme-switcher.d.ts +29 -0
  57. package/dist/components/ui/theme-switcher.js +775 -0
  58. package/dist/components/ui/tooltip.d.ts +6 -0
  59. package/dist/components/ui/virtualized-combobox.d.ts +54 -0
  60. package/dist/components/ui/virtualized-combobox.js +821 -0
  61. package/dist/hooks/use-mobile.d.ts +1 -0
  62. package/dist/lib/query.d.ts +49 -0
  63. package/dist/lib/utils.d.ts +2 -0
  64. package/dist/paraglide/runtime.d.ts +978 -0
  65. package/dist/services/embedding.d.ts +2 -0
  66. package/dist/services/embedding.js +23 -0
  67. package/dist/services/notification/channels/index.d.ts +22 -0
  68. package/dist/services/notification/channels/index.js +11 -0
  69. package/dist/services/notification/channels/ses/index.d.ts +51 -0
  70. package/dist/services/notification/channels/ses/index.js +145 -0
  71. package/dist/services/notification/channels/ses/schema.d.ts +13 -0
  72. package/dist/services/notification/channels/ses/schema.js +35 -0
  73. package/dist/services/notification/index.d.ts +15 -0
  74. package/dist/services/notification/index.js +67 -0
  75. package/dist/services/notification/schema.d.ts +10 -0
  76. package/dist/services/notification/schema.js +30 -0
  77. package/dist/services/opentelemetry.d.ts +8 -0
  78. package/dist/services/opentelemetry.js +23 -0
  79. package/dist/services/s3/index.d.ts +62 -0
  80. package/dist/services/s3/index.js +208 -0
  81. package/dist/services/s3/schema.d.ts +18 -0
  82. package/dist/services/s3/schema.js +37 -0
  83. package/package.json +218 -0
  84. package/tailwind.css +1 -0
@@ -0,0 +1,839 @@
1
+ // ../../src/components/ui/search-menu.tsx
2
+ import { SearchIcon as SearchIcon2 } from "lucide-react";
3
+ import { useCallback, useEffect, useState } from "react";
4
+
5
+ // ../../src/components/ui/button.tsx
6
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
7
+ import { cva } from "class-variance-authority";
8
+
9
+ // ../../src/lib/utils.ts
10
+ import { clsx } from "clsx";
11
+ import { twMerge } from "tailwind-merge";
12
+ function cn(...inputs) {
13
+ return twMerge(clsx(inputs));
14
+ }
15
+
16
+ // ../../src/components/ui/button.tsx
17
+ import { jsxDEV } from "react/jsx-dev-runtime";
18
+ 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", {
19
+ variants: {
20
+ variant: {
21
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
22
+ 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",
23
+ 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",
24
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
25
+ 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",
26
+ link: "text-primary underline-offset-4 hover:underline"
27
+ },
28
+ size: {
29
+ 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",
30
+ 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",
31
+ 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",
32
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
33
+ icon: "size-9",
34
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
35
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
36
+ "icon-lg": "size-10"
37
+ }
38
+ },
39
+ defaultVariants: {
40
+ variant: "default",
41
+ size: "default"
42
+ }
43
+ });
44
+ function Button({
45
+ className,
46
+ variant = "default",
47
+ size = "default",
48
+ ...props
49
+ }) {
50
+ return /* @__PURE__ */ jsxDEV(ButtonPrimitive, {
51
+ "data-slot": "button",
52
+ className: cn(buttonVariants({ variant, size, className })),
53
+ ...props
54
+ }, undefined, false, undefined, this);
55
+ }
56
+
57
+ // ../../src/components/ui/command.tsx
58
+ import { Command as CommandPrimitive } from "cmdk";
59
+ import { SearchIcon } from "lucide-react";
60
+
61
+ // ../../src/components/ui/dialog.tsx
62
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
63
+ import { XIcon } from "lucide-react";
64
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
65
+ function Dialog({ ...props }) {
66
+ return /* @__PURE__ */ jsxDEV2(DialogPrimitive.Root, {
67
+ "data-slot": "dialog",
68
+ ...props
69
+ }, undefined, false, undefined, this);
70
+ }
71
+ function DialogPortal({ ...props }) {
72
+ return /* @__PURE__ */ jsxDEV2(DialogPrimitive.Portal, {
73
+ "data-slot": "dialog-portal",
74
+ ...props
75
+ }, undefined, false, undefined, this);
76
+ }
77
+ function DialogOverlay({
78
+ className,
79
+ ...props
80
+ }) {
81
+ return /* @__PURE__ */ jsxDEV2(DialogPrimitive.Backdrop, {
82
+ "data-slot": "dialog-overlay",
83
+ 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),
84
+ ...props
85
+ }, undefined, false, undefined, this);
86
+ }
87
+ function DialogContent({
88
+ className,
89
+ children,
90
+ ...props
91
+ }) {
92
+ return /* @__PURE__ */ jsxDEV2(DialogPortal, {
93
+ children: [
94
+ /* @__PURE__ */ jsxDEV2(DialogOverlay, {}, undefined, false, undefined, this),
95
+ /* @__PURE__ */ jsxDEV2(DialogPrimitive.Popup, {
96
+ "data-slot": "dialog-content",
97
+ 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),
98
+ ...props,
99
+ children: [
100
+ children,
101
+ /* @__PURE__ */ jsxDEV2(DialogPrimitive.Close, {
102
+ 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",
103
+ children: [
104
+ /* @__PURE__ */ jsxDEV2(XIcon, {
105
+ className: "size-4"
106
+ }, undefined, false, undefined, this),
107
+ /* @__PURE__ */ jsxDEV2("span", {
108
+ className: "sr-only",
109
+ children: "Close"
110
+ }, undefined, false, undefined, this)
111
+ ]
112
+ }, undefined, true, undefined, this)
113
+ ]
114
+ }, undefined, true, undefined, this)
115
+ ]
116
+ }, undefined, true, undefined, this);
117
+ }
118
+ function DialogHeader({ className, ...props }) {
119
+ return /* @__PURE__ */ jsxDEV2("div", {
120
+ "data-slot": "dialog-header",
121
+ className: cn("grid gap-1.5", className),
122
+ ...props
123
+ }, undefined, false, undefined, this);
124
+ }
125
+ function DialogTitle({
126
+ className,
127
+ ...props
128
+ }) {
129
+ return /* @__PURE__ */ jsxDEV2(DialogPrimitive.Title, {
130
+ "data-slot": "dialog-title",
131
+ className: cn("text-lg font-medium", className),
132
+ ...props
133
+ }, undefined, false, undefined, this);
134
+ }
135
+ function DialogDescription({
136
+ className,
137
+ ...props
138
+ }) {
139
+ return /* @__PURE__ */ jsxDEV2(DialogPrimitive.Description, {
140
+ "data-slot": "dialog-description",
141
+ className: cn("text-sm text-muted-foreground", className),
142
+ ...props
143
+ }, undefined, false, undefined, this);
144
+ }
145
+
146
+ // ../../src/components/ui/command.tsx
147
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
148
+ function Command({
149
+ className,
150
+ ...props
151
+ }) {
152
+ return /* @__PURE__ */ jsxDEV3(CommandPrimitive, {
153
+ "data-slot": "command",
154
+ className: cn("flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground", className),
155
+ ...props
156
+ }, undefined, false, undefined, this);
157
+ }
158
+ function CommandDialog({
159
+ title,
160
+ description,
161
+ children,
162
+ className,
163
+ ...props
164
+ }) {
165
+ return /* @__PURE__ */ jsxDEV3(Dialog, {
166
+ ...props,
167
+ children: /* @__PURE__ */ jsxDEV3(DialogContent, {
168
+ className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl p-0", className),
169
+ children: [
170
+ /* @__PURE__ */ jsxDEV3(DialogHeader, {
171
+ className: "sr-only",
172
+ children: [
173
+ /* @__PURE__ */ jsxDEV3(DialogTitle, {
174
+ children: title
175
+ }, undefined, false, undefined, this),
176
+ /* @__PURE__ */ jsxDEV3(DialogDescription, {
177
+ children: description
178
+ }, undefined, false, undefined, this)
179
+ ]
180
+ }, undefined, true, undefined, this),
181
+ children
182
+ ]
183
+ }, undefined, true, undefined, this)
184
+ }, undefined, false, undefined, this);
185
+ }
186
+ function CommandInput({
187
+ className,
188
+ ...props
189
+ }) {
190
+ return /* @__PURE__ */ jsxDEV3("div", {
191
+ "data-slot": "command-input-wrapper",
192
+ className: "p-1 pb-0",
193
+ children: /* @__PURE__ */ jsxDEV3("div", {
194
+ className: "border-input/30 bg-input/30 flex h-9 items-center gap-2 rounded-lg border px-2 shadow-none",
195
+ children: [
196
+ /* @__PURE__ */ jsxDEV3(SearchIcon, {
197
+ className: "size-4 shrink-0 opacity-50"
198
+ }, undefined, false, undefined, this),
199
+ /* @__PURE__ */ jsxDEV3(CommandPrimitive.Input, {
200
+ "data-slot": "command-input",
201
+ className: cn("w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className),
202
+ ...props
203
+ }, undefined, false, undefined, this)
204
+ ]
205
+ }, undefined, true, undefined, this)
206
+ }, undefined, false, undefined, this);
207
+ }
208
+ function CommandList({
209
+ className,
210
+ ...props
211
+ }) {
212
+ return /* @__PURE__ */ jsxDEV3(CommandPrimitive.List, {
213
+ "data-slot": "command-list",
214
+ className: cn("max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
215
+ ...props
216
+ }, undefined, false, undefined, this);
217
+ }
218
+ function CommandEmpty({
219
+ className,
220
+ ...props
221
+ }) {
222
+ return /* @__PURE__ */ jsxDEV3(CommandPrimitive.Empty, {
223
+ "data-slot": "command-empty",
224
+ className: cn("py-6 text-center text-sm", className),
225
+ ...props
226
+ }, undefined, false, undefined, this);
227
+ }
228
+ function CommandGroup({
229
+ className,
230
+ ...props
231
+ }) {
232
+ return /* @__PURE__ */ jsxDEV3(CommandPrimitive.Group, {
233
+ "data-slot": "command-group",
234
+ 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),
235
+ ...props
236
+ }, undefined, false, undefined, this);
237
+ }
238
+ function CommandItem({
239
+ className,
240
+ ...props
241
+ }) {
242
+ return /* @__PURE__ */ jsxDEV3(CommandPrimitive.Item, {
243
+ "data-slot": "command-item",
244
+ 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),
245
+ ...props
246
+ }, undefined, false, undefined, this);
247
+ }
248
+ function CommandShortcut({
249
+ className,
250
+ ...props
251
+ }) {
252
+ return /* @__PURE__ */ jsxDEV3("span", {
253
+ "data-slot": "command-shortcut",
254
+ className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className),
255
+ ...props
256
+ }, undefined, false, undefined, this);
257
+ }
258
+
259
+ // ../../src/paraglide/runtime.js
260
+ import"@inlang/paraglide-js/urlpattern-polyfill";
261
+ var baseLocale = "en";
262
+ var locales = ["en", "fr"];
263
+ var cookieName = "locale";
264
+ var cookieMaxAge = 34560000;
265
+ var cookieDomain = "";
266
+ var localStorageKey = "PARAGLIDE_LOCALE";
267
+ var strategy = [
268
+ "url",
269
+ "cookie",
270
+ "preferredLanguage",
271
+ "baseLocale"
272
+ ];
273
+ var routeStrategies = [
274
+ {
275
+ match: "/api/:path(.*)?",
276
+ exclude: true
277
+ }
278
+ ];
279
+ var urlPatterns = [
280
+ {
281
+ pattern: "/:path(.*)?",
282
+ localized: [
283
+ [
284
+ "en",
285
+ "/en/:path(.*)?"
286
+ ],
287
+ [
288
+ "fr",
289
+ "/fr/:path(.*)?"
290
+ ]
291
+ ]
292
+ }
293
+ ];
294
+ var cachedRouteStrategyUrl;
295
+ var cachedRouteStrategy;
296
+ function findMatchingRouteStrategy(url) {
297
+ if (routeStrategies.length === 0) {
298
+ return;
299
+ }
300
+ const urlString = typeof url === "string" ? url : url.href;
301
+ if (cachedRouteStrategyUrl === urlString) {
302
+ return cachedRouteStrategy;
303
+ }
304
+ const urlObject = new URL(urlString, "http://dummy.com");
305
+ let match;
306
+ for (const routeStrategy of routeStrategies) {
307
+ const pattern = new URLPattern(routeStrategy.match, urlObject.href);
308
+ if (pattern.exec(urlObject.href)) {
309
+ match = routeStrategy;
310
+ break;
311
+ }
312
+ }
313
+ cachedRouteStrategyUrl = urlString;
314
+ cachedRouteStrategy = match;
315
+ return match;
316
+ }
317
+ function getStrategyForUrl(url) {
318
+ const routeStrategy = findMatchingRouteStrategy(url);
319
+ if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
320
+ return routeStrategy.strategy;
321
+ }
322
+ return strategy;
323
+ }
324
+ var serverAsyncLocalStorage = undefined;
325
+ var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
326
+ var experimentalStaticLocale = undefined;
327
+ var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
328
+ var TREE_SHAKE_URL_STRATEGY_USED = true;
329
+ var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
330
+ var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
331
+ var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
332
+ var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
333
+ globalThis.__paraglide = globalThis.__paraglide ?? {};
334
+ globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
335
+ var _locale;
336
+ var localeInitiallySet = false;
337
+ var getLocale = () => {
338
+ if (experimentalStaticLocale !== undefined) {
339
+ return experimentalStaticLocale;
340
+ }
341
+ if (serverAsyncLocalStorage) {
342
+ const locale = serverAsyncLocalStorage?.getStore()?.locale;
343
+ if (locale) {
344
+ return locale;
345
+ }
346
+ }
347
+ let strategyToUse = strategy;
348
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
349
+ strategyToUse = getStrategyForUrl(window.location.href);
350
+ }
351
+ const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
352
+ if (resolved) {
353
+ if (!localeInitiallySet) {
354
+ _locale = resolved;
355
+ localeInitiallySet = true;
356
+ setLocale(resolved, { reload: false });
357
+ }
358
+ return resolved;
359
+ }
360
+ throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
361
+ };
362
+ function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
363
+ let locale;
364
+ for (const strat of strategyToUse) {
365
+ if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
366
+ locale = extractLocaleFromCookie();
367
+ } else if (strat === "baseLocale") {
368
+ locale = baseLocale;
369
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
370
+ locale = extractLocaleFromUrl(urlForUrlStrategy);
371
+ } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
372
+ locale = _locale;
373
+ } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
374
+ locale = extractLocaleFromNavigator();
375
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
376
+ locale = localStorage.getItem(localStorageKey) ?? undefined;
377
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
378
+ const handler = customClientStrategies.get(strat);
379
+ if (handler) {
380
+ const result = handler.getLocale();
381
+ if (result instanceof Promise) {
382
+ continue;
383
+ }
384
+ if (result !== undefined) {
385
+ return assertIsLocale(result);
386
+ }
387
+ }
388
+ }
389
+ const matchedLocale = toLocale(locale);
390
+ if (matchedLocale) {
391
+ return matchedLocale;
392
+ }
393
+ }
394
+ return;
395
+ }
396
+ var rtlLanguages = new Set([
397
+ "ar",
398
+ "dv",
399
+ "fa",
400
+ "he",
401
+ "ks",
402
+ "ku",
403
+ "ps",
404
+ "sd",
405
+ "ug",
406
+ "ur",
407
+ "yi"
408
+ ]);
409
+ var navigateOrReload = (newLocation) => {
410
+ if (newLocation) {
411
+ window.location.href = newLocation;
412
+ } else {
413
+ window.location.reload();
414
+ }
415
+ };
416
+ var setLocale = (newLocale, options) => {
417
+ const optionsWithDefaults = {
418
+ reload: true,
419
+ ...options
420
+ };
421
+ let currentLocale;
422
+ try {
423
+ currentLocale = getLocale();
424
+ } catch {}
425
+ const customSetLocalePromises = [];
426
+ let newLocation = undefined;
427
+ let strategyToUse = strategy;
428
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
429
+ strategyToUse = getStrategyForUrl(window.location.href);
430
+ }
431
+ for (const strat of strategyToUse) {
432
+ if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
433
+ _locale = newLocale;
434
+ } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
435
+ if (isServer || typeof document === "undefined" || typeof window === "undefined") {
436
+ continue;
437
+ }
438
+ const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
439
+ document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
440
+ } else if (strat === "baseLocale") {
441
+ continue;
442
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
443
+ newLocation = localizeUrl(window.location.href, {
444
+ locale: newLocale
445
+ }).href;
446
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
447
+ localStorage.setItem(localStorageKey, newLocale);
448
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
449
+ const handler = customClientStrategies.get(strat);
450
+ if (handler) {
451
+ let result = handler.setLocale(newLocale);
452
+ if (result instanceof Promise) {
453
+ result = result.catch((error) => {
454
+ throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
455
+ cause: error
456
+ });
457
+ });
458
+ customSetLocalePromises.push(result);
459
+ }
460
+ }
461
+ }
462
+ }
463
+ const runReload = () => {
464
+ if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
465
+ navigateOrReload(newLocation);
466
+ }
467
+ };
468
+ if (customSetLocalePromises.length) {
469
+ return Promise.all(customSetLocalePromises).then(() => {
470
+ runReload();
471
+ });
472
+ }
473
+ runReload();
474
+ return;
475
+ };
476
+ var getUrlOrigin = () => {
477
+ if (serverAsyncLocalStorage) {
478
+ return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
479
+ } else if (typeof window !== "undefined") {
480
+ return window.location.origin;
481
+ }
482
+ return "http://fallback.com";
483
+ };
484
+ function toLocale(value) {
485
+ if (typeof value !== "string") {
486
+ return;
487
+ }
488
+ const lowerValue = value.toLowerCase();
489
+ for (const locale of locales) {
490
+ if (locale.toLowerCase() === lowerValue) {
491
+ return locale;
492
+ }
493
+ }
494
+ return;
495
+ }
496
+ function assertIsLocale(input) {
497
+ const locale = toLocale(input);
498
+ if (locale)
499
+ return locale;
500
+ throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
501
+ }
502
+ function extractLocaleFromCookie() {
503
+ if (typeof document === "undefined" || !document.cookie) {
504
+ return;
505
+ }
506
+ const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
507
+ const locale = match?.[2];
508
+ return toLocale(locale);
509
+ }
510
+ function extractLocaleFromNavigator() {
511
+ if (!navigator?.languages?.length) {
512
+ return;
513
+ }
514
+ const languages = navigator.languages.map((lang) => ({
515
+ fullTag: lang,
516
+ baseTag: lang.split("-")[0]
517
+ }));
518
+ for (const lang of languages) {
519
+ const fullLocale = toLocale(lang.fullTag);
520
+ if (fullLocale) {
521
+ return fullLocale;
522
+ }
523
+ const baseLocale2 = toLocale(lang.baseTag);
524
+ if (baseLocale2) {
525
+ return baseLocale2;
526
+ }
527
+ }
528
+ return;
529
+ }
530
+ var cachedUrl;
531
+ var cachedLocale;
532
+ function extractLocaleFromUrl(url) {
533
+ const urlString = typeof url === "string" ? url : url.href;
534
+ if (cachedUrl === urlString) {
535
+ return cachedLocale;
536
+ }
537
+ let result;
538
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
539
+ result = defaultUrlPatternExtractLocale(url);
540
+ } else {
541
+ const urlObj = typeof url === "string" ? new URL(url) : url;
542
+ for (const element of urlPatterns) {
543
+ for (const [locale, localizedPattern] of element.localized) {
544
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
545
+ if (match) {
546
+ result = locale;
547
+ break;
548
+ }
549
+ }
550
+ if (result)
551
+ break;
552
+ }
553
+ }
554
+ cachedUrl = urlString;
555
+ cachedLocale = result;
556
+ return result;
557
+ }
558
+ function defaultUrlPatternExtractLocale(url) {
559
+ const urlObj = new URL(url, "http://dummy.com");
560
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
561
+ return toLocale(pathSegments[0]) || baseLocale;
562
+ }
563
+ function localizeUrl(url, options) {
564
+ const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
565
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
566
+ return localizeUrlDefaultPattern(url, targetLocale);
567
+ }
568
+ const urlObj = typeof url === "string" ? new URL(url) : url;
569
+ for (const element of urlPatterns) {
570
+ for (const [, localizedPattern] of element.localized) {
571
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
572
+ if (!match) {
573
+ continue;
574
+ }
575
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
576
+ if (!targetPattern) {
577
+ continue;
578
+ }
579
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
580
+ return fillMissingUrlParts(localizedUrl, match);
581
+ }
582
+ const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
583
+ if (unlocalizedMatch) {
584
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
585
+ if (targetPattern) {
586
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
587
+ return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
588
+ }
589
+ }
590
+ }
591
+ return urlObj;
592
+ }
593
+ function localizeUrlDefaultPattern(url, locale) {
594
+ const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
595
+ const currentLocale = extractLocaleFromUrl(urlObj);
596
+ if (currentLocale === locale) {
597
+ return urlObj;
598
+ }
599
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
600
+ if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
601
+ pathSegments.shift();
602
+ }
603
+ if (locale === baseLocale) {
604
+ urlObj.pathname = "/" + pathSegments.join("/");
605
+ } else {
606
+ urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
607
+ }
608
+ return urlObj;
609
+ }
610
+ function fillMissingUrlParts(url, match) {
611
+ if (match.protocol.groups["0"]) {
612
+ url.protocol = match.protocol.groups["0"] ?? "";
613
+ }
614
+ if (match.hostname.groups["0"]) {
615
+ url.hostname = match.hostname.groups["0"] ?? "";
616
+ }
617
+ if (match.username.groups["0"]) {
618
+ url.username = match.username.groups["0"] ?? "";
619
+ }
620
+ if (match.password.groups["0"]) {
621
+ url.password = match.password.groups["0"] ?? "";
622
+ }
623
+ if (match.port.groups["0"]) {
624
+ url.port = match.port.groups["0"] ?? "";
625
+ }
626
+ if (match.pathname.groups["0"]) {
627
+ url.pathname = match.pathname.groups["0"] ?? "";
628
+ }
629
+ if (match.search.groups["0"]) {
630
+ url.search = match.search.groups["0"] ?? "";
631
+ }
632
+ if (match.hash.groups["0"]) {
633
+ url.hash = match.hash.groups["0"] ?? "";
634
+ }
635
+ return url;
636
+ }
637
+ function fillPattern(pattern, values, origin) {
638
+ let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
639
+ return `${protocol}#PORT-${port}#${slash}`;
640
+ });
641
+ let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
642
+ if (modifier === "?") {
643
+ return content;
644
+ }
645
+ return content;
646
+ });
647
+ let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
648
+ const value = values[name];
649
+ if (value === null) {
650
+ return "";
651
+ }
652
+ if (modifier === "?") {
653
+ return value !== undefined ? `${slash}${value}` : "";
654
+ }
655
+ if (modifier === "+" || modifier === "*") {
656
+ if (value === undefined && modifier === "+") {
657
+ throw new Error(`Missing value for "${name}" (one or more required)`);
658
+ }
659
+ return value ? `${slash}${value}` : "";
660
+ }
661
+ if (value === undefined) {
662
+ throw new Error(`Missing value for "${name}"`);
663
+ }
664
+ return `${slash}${value}`;
665
+ });
666
+ filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
667
+ return new URL(filled, origin);
668
+ }
669
+ function aggregateGroups(match) {
670
+ return {
671
+ ...match.hash.groups,
672
+ ...match.hostname.groups,
673
+ ...match.password.groups,
674
+ ...match.pathname.groups,
675
+ ...match.port.groups,
676
+ ...match.protocol.groups,
677
+ ...match.search.groups,
678
+ ...match.username.groups
679
+ };
680
+ }
681
+ var customServerStrategies = new Map;
682
+ var customClientStrategies = new Map;
683
+ function isCustomStrategy(strategy2) {
684
+ return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
685
+ }
686
+
687
+ // ../../src/components/ui/search-menu.tsx
688
+ import { jsxDEV as jsxDEV4, Fragment } from "react/jsx-dev-runtime";
689
+ var messages = {
690
+ en: {
691
+ title: "Search",
692
+ description: "Search for an item to open.",
693
+ placeholder: "Search...",
694
+ inputPlaceholder: "Search...",
695
+ emptyMessage: "No results found."
696
+ },
697
+ fr: {
698
+ title: "Recherche",
699
+ description: "Recherchez un élément à ouvrir.",
700
+ placeholder: "Rechercher...",
701
+ inputPlaceholder: "Rechercher...",
702
+ emptyMessage: "Aucun résultat trouvé."
703
+ }
704
+ };
705
+ var searchMenuMessages = (overrides) => ({
706
+ ...getLocale().startsWith("fr") ? messages.fr : messages.en,
707
+ ...overrides
708
+ });
709
+ function SearchMenu({
710
+ groups,
711
+ title,
712
+ description,
713
+ placeholder,
714
+ inputPlaceholder,
715
+ emptyMessage,
716
+ messages: messages2,
717
+ shortcutLabel = "⌘K",
718
+ className,
719
+ open,
720
+ onOpenChange,
721
+ onSelect,
722
+ query,
723
+ onQueryChange,
724
+ shouldFilter
725
+ }) {
726
+ const labels = searchMenuMessages(messages2);
727
+ const resolvedTitle = title ?? labels.title;
728
+ const resolvedDescription = description ?? labels.description;
729
+ const resolvedPlaceholder = placeholder ?? labels.placeholder;
730
+ const resolvedInputPlaceholder = inputPlaceholder ?? labels.inputPlaceholder;
731
+ const resolvedEmptyMessage = emptyMessage ?? labels.emptyMessage;
732
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
733
+ const isControlled = open !== undefined;
734
+ const isOpen = open ?? uncontrolledOpen;
735
+ const setOpen = useCallback((value) => {
736
+ if (!isControlled)
737
+ setUncontrolledOpen(value);
738
+ onOpenChange?.(value);
739
+ }, [isControlled, onOpenChange]);
740
+ useEffect(() => {
741
+ const onKeyDown = (event) => {
742
+ if (event.key.toLowerCase() !== "k")
743
+ return;
744
+ if (!event.metaKey && !event.ctrlKey)
745
+ return;
746
+ event.preventDefault();
747
+ setOpen(!isOpen);
748
+ };
749
+ document.addEventListener("keydown", onKeyDown);
750
+ return () => document.removeEventListener("keydown", onKeyDown);
751
+ }, [isOpen, setOpen]);
752
+ return /* @__PURE__ */ jsxDEV4(Fragment, {
753
+ children: [
754
+ /* @__PURE__ */ jsxDEV4(Button, {
755
+ "aria-label": resolvedPlaceholder,
756
+ type: "button",
757
+ variant: "outline",
758
+ size: "icon",
759
+ className: cn("sm:h-9 sm:w-64 sm:justify-start sm:gap-2.5 sm:px-2.5 sm:font-normal", className),
760
+ onClick: () => setOpen(true),
761
+ children: [
762
+ /* @__PURE__ */ jsxDEV4(SearchIcon2, {
763
+ className: "size-4 shrink-0"
764
+ }, undefined, false, undefined, this),
765
+ /* @__PURE__ */ jsxDEV4("span", {
766
+ className: "text-muted-foreground hidden min-w-0 flex-1 truncate text-left font-normal sm:block",
767
+ children: resolvedPlaceholder
768
+ }, undefined, false, undefined, this),
769
+ /* @__PURE__ */ jsxDEV4("kbd", {
770
+ 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",
771
+ children: shortcutLabel
772
+ }, undefined, false, undefined, this)
773
+ ]
774
+ }, undefined, true, undefined, this),
775
+ /* @__PURE__ */ jsxDEV4(CommandDialog, {
776
+ open: isOpen,
777
+ onOpenChange: setOpen,
778
+ title: resolvedTitle,
779
+ description: resolvedDescription,
780
+ children: /* @__PURE__ */ jsxDEV4(Command, {
781
+ ...shouldFilter === undefined ? {} : { shouldFilter },
782
+ children: [
783
+ /* @__PURE__ */ jsxDEV4(CommandInput, {
784
+ placeholder: resolvedInputPlaceholder,
785
+ ...query === undefined ? {} : { value: query },
786
+ ...onQueryChange ? { onValueChange: onQueryChange } : {}
787
+ }, undefined, false, undefined, this),
788
+ /* @__PURE__ */ jsxDEV4(CommandList, {
789
+ children: [
790
+ /* @__PURE__ */ jsxDEV4(CommandEmpty, {
791
+ children: resolvedEmptyMessage
792
+ }, undefined, false, undefined, this),
793
+ groups.map((group) => /* @__PURE__ */ jsxDEV4(CommandGroup, {
794
+ heading: group.heading,
795
+ children: group.items.map((item) => /* @__PURE__ */ jsxDEV4(CommandItem, {
796
+ 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",
797
+ value: item.label,
798
+ ...item.keywords ? { keywords: item.keywords } : {},
799
+ onSelect: () => {
800
+ setOpen(false);
801
+ item.onSelect?.();
802
+ onSelect?.(item);
803
+ },
804
+ ...item.disabled === undefined ? {} : { disabled: item.disabled },
805
+ children: [
806
+ item.icon ? /* @__PURE__ */ jsxDEV4("div", {
807
+ 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",
808
+ children: item.icon
809
+ }, undefined, false, undefined, this) : null,
810
+ /* @__PURE__ */ jsxDEV4("div", {
811
+ className: "flex min-w-0 flex-1 flex-col gap-0.5",
812
+ children: [
813
+ /* @__PURE__ */ jsxDEV4("span", {
814
+ className: "truncate font-medium",
815
+ children: item.label
816
+ }, undefined, false, undefined, this),
817
+ item.description ? /* @__PURE__ */ jsxDEV4("span", {
818
+ className: "text-muted-foreground truncate text-xs",
819
+ children: item.description
820
+ }, undefined, false, undefined, this) : null
821
+ ]
822
+ }, undefined, true, undefined, this),
823
+ item.shortcut ? /* @__PURE__ */ jsxDEV4(CommandShortcut, {
824
+ children: item.shortcut
825
+ }, undefined, false, undefined, this) : null
826
+ ]
827
+ }, item.id, true, undefined, this))
828
+ }, group.heading, false, undefined, this))
829
+ ]
830
+ }, undefined, true, undefined, this)
831
+ ]
832
+ }, undefined, true, undefined, this)
833
+ }, undefined, false, undefined, this)
834
+ ]
835
+ }, undefined, true, undefined, this);
836
+ }
837
+ export {
838
+ SearchMenu
839
+ };