@nextclaw/ui 0.12.31 → 0.12.33
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/CHANGELOG.md +130 -0
- package/dist/assets/{api-CKKNxbsy.js → api-rASx2-N4.js} +1 -1
- package/dist/assets/{app-manager-provider-BM1hziPv.js → app-manager-provider-CUkcbdWk.js} +1 -1
- package/dist/assets/{channels-list-page-GD_IBCbY.js → channels-list-page-ZWYqfcCe.js} +1 -1
- package/dist/assets/{chat-page-Ty6QH2Tc.js → chat-page-ACm58eUO.js} +1 -1
- package/dist/assets/cpu-DKc3bQic.js +3 -0
- package/dist/assets/desktop-C-cDRCBY.js +3 -0
- package/dist/assets/{desktop-update-config-jWt63bXG.js → desktop-update-config-DAD9JN9Q.js} +1 -1
- package/dist/assets/{dialog-DWZeMf9V.js → dialog-CR80q3Rm.js} +1 -1
- package/dist/assets/{dist-DN-YM_0Y.js → dist-NBjcwlsw.js} +1 -1
- package/dist/assets/doc-browser-D2pq4IHR.js +1 -0
- package/dist/assets/doc-browser-DhIkcy0-.js +1 -0
- package/dist/assets/{doc-browser-context-FukQHvyo.js → doc-browser-context-BPeeiNJ_.js} +1 -1
- package/dist/assets/{doc-browser-CAhfnm0D.js → doc-browser-fLs0TcdS.js} +1 -1
- package/dist/assets/{es2015-ZJ-nWL4L.js → es2015-CVAuMqlM.js} +1 -1
- package/dist/assets/index-DV57tBmg.css +1 -0
- package/dist/assets/index-Db9Cufsy.js +100 -0
- package/dist/assets/{marketplace-page-DzwJTbAg.js → marketplace-page-CAp_gpNe.js} +2 -2
- package/dist/assets/marketplace-page-PPY5uMHK.js +1 -0
- package/dist/assets/mcp-marketplace-page-87__92b1.js +1 -0
- package/dist/assets/{mcp-marketplace-page-BUMkGb6q.js → mcp-marketplace-page-C6HENB6V.js} +1 -1
- package/dist/assets/{model-config-Cgiw7ejv.js → model-config-CK3a8DWH.js} +1 -1
- package/dist/assets/{notice-card-BM2_YNoc.js → notice-card-CF4AJPM3.js} +1 -1
- package/dist/assets/{popover-2H9DS7Cv.js → popover-DeAliE_4.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-DsZJ44ZV.js → provider-scoped-model-input-B8LJ6RCt.js} +1 -1
- package/dist/assets/{providers-list-BrViWRyR.js → providers-list-BTPjqNdK.js} +1 -1
- package/dist/assets/remote-DiPWGRZc.js +1 -0
- package/dist/assets/runtime-config-page-Bb9he7t8.js +1 -0
- package/dist/assets/{search-config-Deb56TtE.js → search-config-BkbSXa9d.js} +1 -1
- package/dist/assets/{secrets-config-JJkgNCnO.js → secrets-config-DFbHCb9n.js} +1 -1
- package/dist/assets/{select-C2c10F3e.js → select-HI5kiwX_.js} +1 -1
- package/dist/assets/{setting-row-CB_ZFbIZ.js → setting-row-B4QnghjV.js} +1 -1
- package/dist/assets/{tag-chip-CrQfVN3A.js → tag-chip-BPgMfp9l.js} +1 -1
- package/dist/assets/{use-config-jAYudJxy.js → use-config-BFqzVF8Y.js} +1 -1
- package/dist/assets/{use-infinite-scroll-loader-B97V1Ywd.js → use-infinite-scroll-loader-DXhw9W4l.js} +1 -1
- package/dist/index.html +16 -16
- package/package.json +9 -9
- package/src/app/components/layout/app-layout.test.tsx +58 -4
- package/src/app/components/layout/app-layout.tsx +2 -2
- package/src/app/components/theme-provider.tsx +0 -1
- package/src/app/hooks/use-viewport-layout.ts +0 -1
- package/src/features/chat/components/chat-session-workspace-panel.tsx +54 -51
- package/src/features/chat/components/conversation/chat-conversation-panel.test.tsx +2 -1
- package/src/features/chat/managers/chat-session-list.manager.test.ts +6 -4
- package/src/features/chat/managers/chat-session-list.manager.ts +0 -6
- package/src/features/chat/utils/chat-message-invalid-tool-arguments.utils.test.ts +79 -0
- package/src/features/chat/utils/chat-message-part.utils.ts +34 -19
- package/src/main.tsx +5 -3
- package/src/platforms/desktop/components/desktop-app-shell.test.tsx +42 -8
- package/src/platforms/desktop/components/desktop-window-chrome.tsx +89 -13
- package/src/platforms/desktop/types/desktop-update.types.ts +6 -2
- package/src/shared/components/doc-browser/doc-browser-context.tsx +0 -27
- package/src/shared/components/doc-browser/doc-browser.test.tsx +11 -9
- package/src/shared/components/doc-browser/doc-browser.tsx +37 -63
- package/src/shared/components/resizable-right-panel/resizable-right-panel.test.tsx +38 -0
- package/src/shared/components/resizable-right-panel/resizable-right-panel.tsx +46 -0
- package/dist/assets/cpu-DPPwMzoC.js +0 -3
- package/dist/assets/desktop-BwONApN9.js +0 -3
- package/dist/assets/doc-browser-p9DDNPWB.js +0 -1
- package/dist/assets/doc-browser-rZIQIjuw.js +0 -1
- package/dist/assets/index-B7CVI2ys.css +0 -1
- package/dist/assets/index-SS1xPoWD.js +0 -100
- package/dist/assets/marketplace-page-DZEljaFz.js +0 -1
- package/dist/assets/mcp-marketplace-page-NfOsALIL.js +0 -1
- package/dist/assets/remote-Dm6hKGew.js +0 -1
- package/dist/assets/runtime-config-page-CvvW9VBj.js +0 -1
|
@@ -47,22 +47,16 @@ interface DocBrowserActions {
|
|
|
47
47
|
open: (url?: string, options?: DocBrowserOpenOptions) => void;
|
|
48
48
|
close: () => void;
|
|
49
49
|
toggleMode: () => void;
|
|
50
|
-
setMode: (mode: DocBrowserMode) => void;
|
|
51
50
|
navigate: (url: string) => void;
|
|
52
51
|
syncUrl: (url: string) => void;
|
|
53
52
|
goBack: () => void;
|
|
54
53
|
goForward: () => void;
|
|
55
|
-
openNewTab: (url?: string, options?: Omit<DocBrowserOpenOptions, 'newTab'>) => void;
|
|
56
54
|
closeTab: (tabId: string) => void;
|
|
57
55
|
setActiveTab: (tabId: string) => void;
|
|
58
|
-
canGoBack: boolean;
|
|
59
|
-
canGoForward: boolean;
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
type DocBrowserContextValue = DocBrowserState & DocBrowserActions & {
|
|
63
|
-
currentUrl: string;
|
|
64
59
|
currentTab?: DocBrowserTab;
|
|
65
|
-
navVersion: number;
|
|
66
60
|
};
|
|
67
61
|
|
|
68
62
|
const DocBrowserContext = createContext<DocBrowserContextValue | null>(null);
|
|
@@ -318,10 +312,6 @@ export function DocBrowserProvider({ children }: { children: ReactNode }) {
|
|
|
318
312
|
setState((prev) => ({ ...prev, mode: prev.mode === 'floating' ? 'docked' : 'floating' }));
|
|
319
313
|
}, []);
|
|
320
314
|
|
|
321
|
-
const setMode = useCallback((mode: DocBrowserMode) => {
|
|
322
|
-
setState((prev) => ({ ...prev, mode }));
|
|
323
|
-
}, []);
|
|
324
|
-
|
|
325
315
|
const navigate = useCallback((url: string) => {
|
|
326
316
|
setState((prev) => {
|
|
327
317
|
if (!prev.tabs.length) {
|
|
@@ -401,10 +391,6 @@ export function DocBrowserProvider({ children }: { children: ReactNode }) {
|
|
|
401
391
|
}));
|
|
402
392
|
}, []);
|
|
403
393
|
|
|
404
|
-
const openNewTab = useCallback((url?: string, options?: Omit<DocBrowserOpenOptions, 'newTab'>) => {
|
|
405
|
-
open(url, { ...(options ?? {}), newTab: true });
|
|
406
|
-
}, [open]);
|
|
407
|
-
|
|
408
394
|
const closeTab = useCallback((tabId: string) => {
|
|
409
395
|
setState((prev) => {
|
|
410
396
|
if (prev.tabs.length <= 1) {
|
|
@@ -444,43 +430,30 @@ export function DocBrowserProvider({ children }: { children: ReactNode }) {
|
|
|
444
430
|
});
|
|
445
431
|
}, []);
|
|
446
432
|
|
|
447
|
-
const canGoBack = Boolean(currentTab && currentTab.kind === 'docs' && currentTab.historyIndex > 0);
|
|
448
|
-
const canGoForward = Boolean(currentTab && currentTab.kind === 'docs' && currentTab.historyIndex < currentTab.history.length - 1);
|
|
449
|
-
|
|
450
433
|
const value = useMemo<DocBrowserContextValue>(() => ({
|
|
451
434
|
...state,
|
|
452
435
|
currentTab,
|
|
453
|
-
currentUrl: currentTab?.currentUrl ?? getDefaultDocsUrl(),
|
|
454
|
-
navVersion: currentTab?.navVersion ?? 0,
|
|
455
436
|
open,
|
|
456
437
|
close,
|
|
457
438
|
toggleMode,
|
|
458
|
-
setMode,
|
|
459
439
|
navigate,
|
|
460
440
|
syncUrl,
|
|
461
441
|
goBack,
|
|
462
442
|
goForward,
|
|
463
|
-
openNewTab,
|
|
464
443
|
closeTab,
|
|
465
444
|
setActiveTab,
|
|
466
|
-
canGoBack,
|
|
467
|
-
canGoForward,
|
|
468
445
|
}), [
|
|
469
446
|
state,
|
|
470
447
|
currentTab,
|
|
471
448
|
open,
|
|
472
449
|
close,
|
|
473
450
|
toggleMode,
|
|
474
|
-
setMode,
|
|
475
451
|
navigate,
|
|
476
452
|
syncUrl,
|
|
477
453
|
goBack,
|
|
478
454
|
goForward,
|
|
479
|
-
openNewTab,
|
|
480
455
|
closeTab,
|
|
481
456
|
setActiveTab,
|
|
482
|
-
canGoBack,
|
|
483
|
-
canGoForward,
|
|
484
457
|
]);
|
|
485
458
|
|
|
486
459
|
return (
|
|
@@ -27,34 +27,36 @@ const { docBrowserState } = vi.hoisted(() => ({
|
|
|
27
27
|
historyIndex: 0,
|
|
28
28
|
navVersion: 0,
|
|
29
29
|
},
|
|
30
|
-
currentUrl: "https://docs.nextclaw.io/en/guide/getting-started",
|
|
31
|
-
navVersion: 0,
|
|
32
30
|
close: vi.fn(),
|
|
33
31
|
toggleMode: vi.fn(),
|
|
34
32
|
goBack: vi.fn(),
|
|
35
33
|
goForward: vi.fn(),
|
|
36
|
-
canGoBack: false,
|
|
37
|
-
canGoForward: false,
|
|
38
34
|
navigate: vi.fn(),
|
|
39
35
|
syncUrl: vi.fn(),
|
|
40
36
|
setActiveTab: vi.fn(),
|
|
41
37
|
closeTab: vi.fn(),
|
|
42
|
-
openNewTab: vi.fn(),
|
|
43
38
|
},
|
|
44
39
|
}));
|
|
45
40
|
|
|
46
41
|
vi.mock("@/shared/components/doc-browser/doc-browser-context", async () => {
|
|
47
|
-
const actual = await vi.importActual
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
const actual = await vi.importActual(
|
|
43
|
+
"@/shared/components/doc-browser/doc-browser-context",
|
|
44
|
+
);
|
|
50
45
|
|
|
51
46
|
return {
|
|
52
|
-
...actual,
|
|
47
|
+
...(actual as object),
|
|
53
48
|
useDocBrowser: () => docBrowserState,
|
|
54
49
|
};
|
|
55
50
|
});
|
|
56
51
|
|
|
57
52
|
describe("DocBrowser", () => {
|
|
53
|
+
it("uses the shared right panel resize handle in docked mode", () => {
|
|
54
|
+
render(<DocBrowser />);
|
|
55
|
+
|
|
56
|
+
expect(screen.getByTestId("doc-browser-panel").style.width).toBe("420px");
|
|
57
|
+
expect(screen.getByTestId("resizable-right-panel-handle")).toBeTruthy();
|
|
58
|
+
});
|
|
59
|
+
|
|
58
60
|
it("uses a full viewport panel without desktop resize controls in fullscreen mode", () => {
|
|
59
61
|
render(<DocBrowser displayMode="fullscreen" />);
|
|
60
62
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useRef, useCallback, useEffect, type CSSProperties } from 'react';
|
|
2
2
|
import { DOCS_DEFAULT_BASE_URL, isDocsUrl, useDocBrowser } from './doc-browser-context';
|
|
3
|
+
import { ResizableRightPanel } from '@/shared/components/resizable-right-panel/resizable-right-panel';
|
|
3
4
|
import { cn } from '@/shared/lib/utils';
|
|
4
5
|
import { t } from '@/shared/lib/i18n';
|
|
5
6
|
import {
|
|
@@ -15,40 +16,26 @@ import {
|
|
|
15
16
|
Plus,
|
|
16
17
|
} from 'lucide-react';
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
* DocBrowser — An in-app micro-browser for documentation.
|
|
20
|
-
*
|
|
21
|
-
* Supports:
|
|
22
|
-
* - multi-tab browsing
|
|
23
|
-
* - `docked`: right sidebar panel (horizontally resizable)
|
|
24
|
-
* - `floating`: draggable, resizable overlay
|
|
25
|
-
* - `fullscreen`: full viewport overlay for narrow mobile shells
|
|
26
|
-
*/
|
|
27
19
|
type DocBrowserProps = {
|
|
28
20
|
displayMode?: 'desktop' | 'fullscreen';
|
|
29
21
|
};
|
|
30
22
|
|
|
31
|
-
function getPanelClassName(isFullscreen: boolean
|
|
23
|
+
function getPanelClassName(isFullscreen: boolean): string {
|
|
32
24
|
return cn(
|
|
33
25
|
'flex flex-col bg-white overflow-hidden relative',
|
|
34
26
|
isFullscreen
|
|
35
27
|
? 'fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl'
|
|
36
|
-
:
|
|
37
|
-
? 'h-full border-l border-gray-200 shrink-0'
|
|
38
|
-
: 'rounded-2xl shadow-2xl border border-gray-200',
|
|
28
|
+
: 'rounded-2xl shadow-2xl border border-gray-200',
|
|
39
29
|
);
|
|
40
30
|
}
|
|
41
31
|
|
|
42
32
|
function getPanelStyle(params: {
|
|
43
33
|
isFullscreen: boolean;
|
|
44
|
-
isDocked: boolean;
|
|
45
|
-
dockedWidth: number;
|
|
46
34
|
floatPos: { x: number; y: number };
|
|
47
35
|
floatSize: { w: number; h: number };
|
|
48
36
|
}): CSSProperties | undefined {
|
|
49
|
-
const { isFullscreen,
|
|
37
|
+
const { isFullscreen, floatPos, floatSize } = params;
|
|
50
38
|
if (isFullscreen) return undefined;
|
|
51
|
-
if (isDocked) return { width: dockedWidth };
|
|
52
39
|
return {
|
|
53
40
|
position: 'fixed',
|
|
54
41
|
left: floatPos.x,
|
|
@@ -66,19 +53,15 @@ export function DocBrowser({ displayMode = 'desktop' }: DocBrowserProps) {
|
|
|
66
53
|
tabs,
|
|
67
54
|
activeTabId,
|
|
68
55
|
currentTab,
|
|
69
|
-
|
|
70
|
-
navVersion,
|
|
56
|
+
open,
|
|
71
57
|
close,
|
|
72
58
|
toggleMode,
|
|
73
59
|
goBack,
|
|
74
60
|
goForward,
|
|
75
|
-
canGoBack,
|
|
76
|
-
canGoForward,
|
|
77
61
|
navigate,
|
|
78
62
|
syncUrl,
|
|
79
63
|
setActiveTab,
|
|
80
64
|
closeTab,
|
|
81
|
-
openNewTab,
|
|
82
65
|
} = useDocBrowser();
|
|
83
66
|
|
|
84
67
|
const [urlInput, setUrlInput] = useState('');
|
|
@@ -89,11 +72,11 @@ export function DocBrowser({ displayMode = 'desktop' }: DocBrowserProps) {
|
|
|
89
72
|
y: 80,
|
|
90
73
|
}));
|
|
91
74
|
const [floatSize, setFloatSize] = useState({ w: 480, h: 600 });
|
|
92
|
-
const [dockedWidth, setDockedWidth] = useState(420);
|
|
93
75
|
const dragRef = useRef<{ startX: number; startY: number; startPosX: number; startPosY: number } | null>(null);
|
|
94
76
|
const resizeRef = useRef<{ startX: number; startY: number; startW: number; startH: number } | null>(null);
|
|
95
|
-
const dockResizeRef = useRef<{ startX: number; startW: number } | null>(null);
|
|
96
77
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
78
|
+
const currentUrl = currentTab?.currentUrl ?? DOCS_DEFAULT_BASE_URL;
|
|
79
|
+
const navVersion = currentTab?.navVersion ?? 0;
|
|
97
80
|
const prevNavVersionRef = useRef(navVersion);
|
|
98
81
|
const isDocsTab = currentTab?.kind === 'docs';
|
|
99
82
|
|
|
@@ -227,26 +210,6 @@ export function DocBrowser({ displayMode = 'desktop' }: DocBrowserProps) {
|
|
|
227
210
|
window.addEventListener('mouseup', onUp);
|
|
228
211
|
}, [floatSize]);
|
|
229
212
|
|
|
230
|
-
const onDockResizeStart = useCallback((e: React.MouseEvent) => {
|
|
231
|
-
e.preventDefault();
|
|
232
|
-
e.stopPropagation();
|
|
233
|
-
setIsResizing(true);
|
|
234
|
-
dockResizeRef.current = { startX: e.clientX, startW: dockedWidth };
|
|
235
|
-
const onMove = (ev: MouseEvent) => {
|
|
236
|
-
if (!dockResizeRef.current) return;
|
|
237
|
-
const delta = dockResizeRef.current.startX - ev.clientX;
|
|
238
|
-
setDockedWidth(Math.max(320, Math.min(860, dockResizeRef.current.startW + delta)));
|
|
239
|
-
};
|
|
240
|
-
const onUp = () => {
|
|
241
|
-
setIsResizing(false);
|
|
242
|
-
dockResizeRef.current = null;
|
|
243
|
-
window.removeEventListener('mousemove', onMove);
|
|
244
|
-
window.removeEventListener('mouseup', onUp);
|
|
245
|
-
};
|
|
246
|
-
window.addEventListener('mousemove', onMove);
|
|
247
|
-
window.addEventListener('mouseup', onUp);
|
|
248
|
-
}, [dockedWidth]);
|
|
249
|
-
|
|
250
213
|
const onLeftResizeStart = useCallback((e: React.MouseEvent) => {
|
|
251
214
|
e.preventDefault();
|
|
252
215
|
e.stopPropagation();
|
|
@@ -273,28 +236,16 @@ export function DocBrowser({ displayMode = 'desktop' }: DocBrowserProps) {
|
|
|
273
236
|
|
|
274
237
|
const isDocked = mode === 'docked';
|
|
275
238
|
const isFullscreen = displayMode === 'fullscreen';
|
|
276
|
-
const canDragPanel = !isDocked && !isFullscreen;
|
|
277
|
-
|
|
278
|
-
const panel = (
|
|
279
|
-
<div
|
|
280
|
-
data-testid="doc-browser-panel"
|
|
281
|
-
className={getPanelClassName(isFullscreen, isDocked)}
|
|
282
|
-
style={getPanelStyle({ isFullscreen, isDocked, dockedWidth, floatPos, floatSize })}
|
|
283
|
-
>
|
|
284
|
-
{isDocked && !isFullscreen && (
|
|
285
|
-
<div
|
|
286
|
-
className="absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors"
|
|
287
|
-
onMouseDown={onDockResizeStart}
|
|
288
|
-
/>
|
|
289
|
-
)}
|
|
290
239
|
|
|
240
|
+
const panelContent = (
|
|
241
|
+
<>
|
|
291
242
|
<div
|
|
292
243
|
className={cn(
|
|
293
244
|
'flex items-center justify-between px-4 py-2.5 bg-gray-50 border-b border-gray-200 shrink-0 select-none',
|
|
294
|
-
|
|
245
|
+
!isDocked && !isFullscreen && 'cursor-grab active:cursor-grabbing',
|
|
295
246
|
isFullscreen && 'pt-[calc(env(safe-area-inset-top,0px)+0.625rem)]',
|
|
296
247
|
)}
|
|
297
|
-
onMouseDown={
|
|
248
|
+
onMouseDown={!isDocked && !isFullscreen ? onDragStart : undefined}
|
|
298
249
|
>
|
|
299
250
|
<div className="flex items-center gap-2.5 min-w-0">
|
|
300
251
|
<BookOpen className="w-4 h-4 text-primary shrink-0" />
|
|
@@ -356,7 +307,7 @@ export function DocBrowser({ displayMode = 'desktop' }: DocBrowserProps) {
|
|
|
356
307
|
);
|
|
357
308
|
})}
|
|
358
309
|
<button
|
|
359
|
-
onClick={() =>
|
|
310
|
+
onClick={() => open(undefined, { kind: 'docs', newTab: true, title: 'Docs' })}
|
|
360
311
|
className="inline-flex items-center justify-center w-7 h-7 rounded-lg border border-[#eee3d1] bg-white text-[#78644d] hover:bg-[#fff7ea] hover:text-[#2f2212] shrink-0"
|
|
361
312
|
title={t('docBrowserNewTab')}
|
|
362
313
|
>
|
|
@@ -368,14 +319,14 @@ export function DocBrowser({ displayMode = 'desktop' }: DocBrowserProps) {
|
|
|
368
319
|
<div className="flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0">
|
|
369
320
|
<button
|
|
370
321
|
onClick={goBack}
|
|
371
|
-
disabled={!
|
|
322
|
+
disabled={!isDocsTab || (currentTab?.historyIndex ?? 0) <= 0}
|
|
372
323
|
className="p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors"
|
|
373
324
|
>
|
|
374
325
|
<ArrowLeft className="w-4 h-4" />
|
|
375
326
|
</button>
|
|
376
327
|
<button
|
|
377
328
|
onClick={goForward}
|
|
378
|
-
disabled={!
|
|
329
|
+
disabled={!isDocsTab || (currentTab?.historyIndex ?? 0) >= (currentTab?.history.length ?? 0) - 1}
|
|
379
330
|
className="p-1.5 rounded-md hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed text-gray-600 transition-colors"
|
|
380
331
|
>
|
|
381
332
|
<ArrowRight className="w-4 h-4" />
|
|
@@ -423,6 +374,29 @@ export function DocBrowser({ displayMode = 'desktop' }: DocBrowserProps) {
|
|
|
423
374
|
</a>
|
|
424
375
|
</div>
|
|
425
376
|
)}
|
|
377
|
+
</>
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
if (isDocked && !isFullscreen) {
|
|
381
|
+
return (
|
|
382
|
+
<ResizableRightPanel
|
|
383
|
+
data-testid="doc-browser-panel"
|
|
384
|
+
defaultWidth={420}
|
|
385
|
+
minWidth={320}
|
|
386
|
+
maxWidth={860}
|
|
387
|
+
>
|
|
388
|
+
{panelContent}
|
|
389
|
+
</ResizableRightPanel>
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const panel = (
|
|
394
|
+
<div
|
|
395
|
+
data-testid="doc-browser-panel"
|
|
396
|
+
className={getPanelClassName(isFullscreen)}
|
|
397
|
+
style={getPanelStyle({ isFullscreen, floatPos, floatSize })}
|
|
398
|
+
>
|
|
399
|
+
{panelContent}
|
|
426
400
|
|
|
427
401
|
{!isDocked && !isFullscreen && (
|
|
428
402
|
<>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ResizableRightPanel } from "./resizable-right-panel";
|
|
4
|
+
|
|
5
|
+
describe("ResizableRightPanel", () => {
|
|
6
|
+
it("resizes horizontally from the left handle and clamps to max width", () => {
|
|
7
|
+
render(
|
|
8
|
+
<ResizableRightPanel
|
|
9
|
+
data-testid="right-panel"
|
|
10
|
+
defaultWidth={420}
|
|
11
|
+
minWidth={320}
|
|
12
|
+
maxWidth={500}
|
|
13
|
+
>
|
|
14
|
+
Content
|
|
15
|
+
</ResizableRightPanel>,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
fireEvent.mouseDown(screen.getByTestId("resizable-right-panel-handle"), {
|
|
19
|
+
clientX: 800,
|
|
20
|
+
});
|
|
21
|
+
fireEvent.mouseMove(window, { clientX: 600 });
|
|
22
|
+
|
|
23
|
+
expect(screen.getByTestId("right-panel").style.width).toBe("500px");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("does not render resize controls in overlay mode", () => {
|
|
27
|
+
render(
|
|
28
|
+
<ResizableRightPanel data-testid="right-panel" overlay>
|
|
29
|
+
Content
|
|
30
|
+
</ResizableRightPanel>,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
expect(
|
|
34
|
+
screen.queryByTestId("resizable-right-panel-handle"),
|
|
35
|
+
).toBeNull();
|
|
36
|
+
expect(screen.getByTestId("right-panel").className).toContain("fixed");
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useRef, useState, type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { cn } from "@/shared/lib/utils";
|
|
3
|
+
|
|
4
|
+
type ResizableRightPanelProps = ComponentPropsWithoutRef<"aside"> & { defaultWidth?: number; minWidth?: number; maxWidth?: number; overlay?: boolean };
|
|
5
|
+
|
|
6
|
+
export function ResizableRightPanel({ children, className, style, defaultWidth = 420, minWidth = 320, maxWidth = 860, overlay = false, ...props }: ResizableRightPanelProps) {
|
|
7
|
+
const resizeRef = useRef<{ startX: number; startWidth: number } | null>(null);
|
|
8
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
9
|
+
const [width, setWidth] = useState(defaultWidth);
|
|
10
|
+
|
|
11
|
+
const onResizeStart = (event: React.MouseEvent) => {
|
|
12
|
+
if (overlay) return;
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
setIsResizing(true);
|
|
16
|
+
resizeRef.current = { startX: event.clientX, startWidth: width };
|
|
17
|
+
const onMove = (moveEvent: MouseEvent) => {
|
|
18
|
+
const resizing = resizeRef.current;
|
|
19
|
+
if (!resizing) return;
|
|
20
|
+
const nextWidth = resizing.startWidth + resizing.startX - moveEvent.clientX;
|
|
21
|
+
setWidth(Math.max(minWidth, Math.min(maxWidth, nextWidth)));
|
|
22
|
+
};
|
|
23
|
+
const onUp = () => {
|
|
24
|
+
setIsResizing(false);
|
|
25
|
+
resizeRef.current = null;
|
|
26
|
+
window.removeEventListener("mousemove", onMove);
|
|
27
|
+
window.removeEventListener("mouseup", onUp);
|
|
28
|
+
};
|
|
29
|
+
window.addEventListener("mousemove", onMove);
|
|
30
|
+
window.addEventListener("mouseup", onUp);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<aside
|
|
35
|
+
{...props}
|
|
36
|
+
className={cn("relative flex h-full min-h-0 shrink-0 overflow-hidden bg-white", overlay ? "fixed inset-0 z-40" : "border-l border-gray-200", className)}
|
|
37
|
+
style={overlay ? style : { ...style, width }}
|
|
38
|
+
>
|
|
39
|
+
{!overlay ? (
|
|
40
|
+
<div className="absolute left-0 top-0 z-20 h-full w-1.5 cursor-ew-resize transition-colors hover:bg-primary/10" data-testid="resizable-right-panel-handle" onMouseDown={onResizeStart} />
|
|
41
|
+
) : null}
|
|
42
|
+
<div className="flex h-full min-h-0 w-full flex-col overflow-hidden">{children}</div>
|
|
43
|
+
{isResizing ? <div className="absolute inset-0 z-10" /> : null}
|
|
44
|
+
</aside>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{_ as e,m as t}from"./i18n-D1144VAA.js";import{t as n}from"./createLucideIcon-DzY6wN61.js";var r=`modulepreload`,i=function(e){return`/`+e},a={},o=function(e,t,n){let o=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(t.map(t=>{if(t=i(t,n),t in a)return;a[t]=!0;let o=t.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.href===t&&(!o||r.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:r,o||(l.as=`script`),l.crossOrigin=``,l.href=t,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,n)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},s=e(t(),1),c=`popstate`;function l(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return m(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:h(t)}return _(t,n,null,e)}function u(e,t){if(e===!1||e==null)throw Error(t)}function d(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function f(){return Math.random().toString(36).substring(2,10)}function p(e,t){return{usr:e.state,key:e.key,idx:t}}function m(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?g(t):t,state:n,key:t&&t.key||r||f()}}function h({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function g(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function _(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,l=null,u=d();u??(u=0,o.replaceState({...o.state,idx:u},``));function d(){return(o.state||{idx:null}).idx}function f(){s=`POP`;let e=d(),t=e==null?null:e-u;u=e,l&&l({action:s,location:y.location,delta:t})}function h(e,t){s=`PUSH`;let r=m(y.location,e,t);n&&n(r,e),u=d()+1;let c=p(r,u),f=y.createHref(r);try{o.pushState(c,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&l&&l({action:s,location:y.location,delta:1})}function g(e,t){s=`REPLACE`;let r=m(y.location,e,t);n&&n(r,e),u=d();let i=p(r,u),c=y.createHref(r);o.replaceState(i,``,c),a&&l&&l({action:s,location:y.location,delta:0})}function _(e){return v(e)}let y={get action(){return s},get location(){return e(i,o)},listen(e){if(l)throw Error(`A history only accepts one active listener`);return i.addEventListener(c,f),l=e,()=>{i.removeEventListener(c,f),l=null}},createHref(e){return t(i,e)},createURL:_,encodeLocation(e){let t=_(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:h,replace:g,go(e){return o.go(e)}};return y}function v(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),u(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:h(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function y(e,t,n=`/`){return b(e,t,n,!1)}function b(e,t,n,r){let i=D((typeof t==`string`?g(t):t).pathname||`/`,n);if(i==null)return null;let a=S(e);w(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=ue(i);o=ce(a[e],t,r)}return o}function x(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function S(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;u(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=j([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(u(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),S(e.children,t,d,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:oe(l,e.index),routesMeta:d})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of C(e.path))a(e,t,!0,n)}),t}function C(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=C(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function w(e){e.sort((e,t)=>e.score===t.score?se(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var T=/^:[\w-]+$/,ee=3,te=2,ne=1,re=10,ie=-2,ae=e=>e===`*`;function oe(e,t){let n=e.split(`/`),r=n.length;return n.some(ae)&&(r+=ie),t&&(r+=te),n.filter(e=>!ae(e)).reduce((e,t)=>e+(T.test(t)?ee:t===``?ne:re),r)}function se(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ce(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=E({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:j([a,u.pathname]),pathnameBase:he(j([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=j([a,u.pathnameBase]))}return o}function E(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=le(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function le(e,t=!1,n=!0){d(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ue(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return d(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function D(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var de=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function fe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?g(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?pe(n.substring(1),`/`):pe(n,t)):a=t,{pathname:a,search:ge(r),hash:_e(i)}}function pe(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function O(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function me(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function k(e){let t=me(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function A(e,t,n,r=!1){let i;typeof e==`string`?i=g(e):(i={...e},u(!i.pathname||!i.pathname.includes(`?`),O(`?`,`pathname`,`search`,i)),u(!i.pathname||!i.pathname.includes(`#`),O(`#`,`pathname`,`hash`,i)),u(!i.search||!i.search.includes(`#`),O(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=fe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||d)&&(c.pathname+=`/`),c}var j=e=>e.join(`/`).replace(/\/\/+/g,`/`),he=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),ge=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,_e=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ve=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function ye(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function be(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var xe=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Se(e,t){let n=e;if(typeof n!=`string`||!de.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(xe)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=D(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{d(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ce=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Ce);var we=[`GET`,...Ce];new Set(we);var M=s.createContext(null);M.displayName=`DataRouter`;var N=s.createContext(null);N.displayName=`DataRouterState`;var Te=s.createContext(!1),Ee=s.createContext({isTransitioning:!1});Ee.displayName=`ViewTransition`;var De=s.createContext(new Map);De.displayName=`Fetchers`;var Oe=s.createContext(null);Oe.displayName=`Await`;var P=s.createContext(null);P.displayName=`Navigation`;var F=s.createContext(null);F.displayName=`Location`;var I=s.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var L=s.createContext(null);L.displayName=`RouteError`;var ke=`REACT_ROUTER_ERROR`,Ae=`REDIRECT`,je=`ROUTE_ERROR_RESPONSE`;function Me(e){if(e.startsWith(`${ke}:${Ae}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Ne(e){if(e.startsWith(`${ke}:${je}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new ve(t.status,t.statusText,t.data)}catch{}}function Pe(e,{relative:t}={}){u(R(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=s.useContext(P),{hash:i,pathname:a,search:o}=V(e,{relative:t}),c=a;return n!==`/`&&(c=a===`/`?n:j([n,a])),r.createHref({pathname:c,search:o,hash:i})}function R(){return s.useContext(F)!=null}function z(){return u(R(),`useLocation() may be used only in the context of a <Router> component.`),s.useContext(F).location}var Fe=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ie(e){s.useContext(P).static||s.useLayoutEffect(e)}function B(){let{isDataRoute:e}=s.useContext(I);return e?nt():Le()}function Le(){u(R(),`useNavigate() may be used only in the context of a <Router> component.`);let e=s.useContext(M),{basename:t,navigator:n}=s.useContext(P),{matches:r}=s.useContext(I),{pathname:i}=z(),a=JSON.stringify(k(r)),o=s.useRef(!1);return Ie(()=>{o.current=!0}),s.useCallback((r,s={})=>{if(d(o.current,Fe),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=A(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:j([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}s.createContext(null);function Re(){let{matches:e}=s.useContext(I),t=e[e.length-1];return t?t.params:{}}function V(e,{relative:t}={}){let{matches:n}=s.useContext(I),{pathname:r}=z(),i=JSON.stringify(k(n));return s.useMemo(()=>A(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function ze(e,t){return Be(e,t)}function Be(e,t,n,r,i){u(R(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=s.useContext(P),{matches:o}=s.useContext(I),c=o[o.length-1],l=c?c.params:{},f=c?c.pathname:`/`,p=c?c.pathnameBase:`/`,m=c&&c.route;{let e=m&&m.path||``;it(f,!m||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
|
-
|
|
3
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let h=z(),_;if(t){let e=typeof t==`string`?g(t):t;u(p===`/`||e.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${e.pathname}" was given in the \`location\` prop.`),_=e}else _=h;let v=_.pathname||`/`,b=v;if(p!==`/`){let e=p.replace(/^\//,``).split(`/`);b=`/`+v.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let x=y(e,{pathname:b});d(m||x!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),d(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=Ke(x&&x.map(e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:j([p,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?p:j([p,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&S?s.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,..._},navigationType:`POP`}},S):S}function Ve(){let e=tt(),t=ye(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=s.createElement(s.Fragment,null,s.createElement(`p`,null,`💿 Hey developer 👋`),s.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,s.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,s.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),s.createElement(s.Fragment,null,s.createElement(`h2`,null,`Unexpected Application Error!`),s.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?s.createElement(`pre`,{style:i},n):null,o)}var He=s.createElement(Ve,null),Ue=class extends s.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Ne(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:s.createElement(I.Provider,{value:this.props.routeContext},s.createElement(L.Provider,{value:e,children:this.props.component}));return this.context?s.createElement(We,{error:e},t):t}};Ue.contextType=Te;var H=new WeakMap;function We({children:e,error:t}){let{basename:n}=s.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Me(t.digest);if(e){let r=H.get(t);if(r)throw r;let i=Se(e.location,n);if(xe&&!H.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw H.set(t,n),n}return s.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Ge({routeContext:e,match:t,children:n}){let r=s.useContext(M);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),s.createElement(I.Provider,{value:e},n)}function Ke(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);u(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let c=!1,l=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(l=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){c=!0,a=l>=0?a.slice(0,l+1):[a[0]];break}}}let d=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:be(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,f=!1,p=null,m=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,p=r.route.errorElement||He,c&&(l<0&&i===0?(it(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),f=!0,m=null):l===i&&(f=!0,m=r.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,i+1)),g=()=>{let t;return t=u?p:f?m:r.route.Component?s.createElement(r.route.Component,null):r.route.element?r.route.element:e,s.createElement(Ge,{match:r,routeContext:{outlet:e,matches:h,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?s.createElement(Ue,{location:n.location,revalidation:n.revalidation,component:p,error:u,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:d}):g()},null)}function qe(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Je(e){let t=s.useContext(M);return u(t,qe(e)),t}function Ye(e){let t=s.useContext(N);return u(t,qe(e)),t}function Xe(e){let t=s.useContext(I);return u(t,qe(e)),t}function Ze(e){let t=Xe(e),n=t.matches[t.matches.length-1];return u(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Qe(){return Ze(`useRouteId`)}function $e(){return Ye(`useNavigation`).navigation}function et(){let{matches:e,loaderData:t}=Ye(`useMatches`);return s.useMemo(()=>e.map(e=>x(e,t)),[e,t])}function tt(){let e=s.useContext(L),t=Ye(`useRouteError`),n=Ze(`useRouteError`);return e===void 0?t.errors?.[n]:e}function nt(){let{router:e}=Je(`useNavigate`),t=Ze(`useNavigate`),n=s.useRef(!1);return Ie(()=>{n.current=!0}),s.useCallback(async(r,i={})=>{d(n.current,Fe),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var rt={};function it(e,t,n){!t&&!rt[e]&&(rt[e]=!0,d(!1,n))}s.useOptimistic,s.memo(at);function at({routes:e,future:t,state:n,onError:r}){return Be(e,void 0,n,r,t)}function ot({to:e,replace:t,state:n,relative:r}){u(R(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=s.useContext(P);d(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=s.useContext(I),{pathname:o}=z(),c=B(),l=A(e,k(a),o,r===`path`),f=JSON.stringify(l);return s.useEffect(()=>{c(JSON.parse(f),{replace:t,state:n,relative:r})},[c,f,r,t,n]),null}function st(e){u(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function ct({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){u(!R(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let c=e.replace(/^\/*/,`/`),l=s.useMemo(()=>({basename:c,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[c,i,a,o]);typeof n==`string`&&(n=g(n));let{pathname:f=`/`,search:p=``,hash:m=``,state:h=null,key:_=`default`}=n,v=s.useMemo(()=>{let e=D(f,c);return e==null?null:{location:{pathname:e,search:p,hash:m,state:h,key:_},navigationType:r}},[c,f,p,m,h,_,r]);return d(v!=null,`<Router basename="${c}"> is not able to match the URL "${f}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:s.createElement(P.Provider,{value:l},s.createElement(F.Provider,{children:t,value:v}))}function lt({children:e,location:t}){return ze(U(e),t)}s.Component;function U(e,t=[]){let n=[];return s.Children.forEach(e,(e,r)=>{if(!s.isValidElement(e))return;let i=[...t,r];if(e.type===s.Fragment){n.push.apply(n,U(e.props.children,i));return}u(e.type===st,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),u(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=U(e.props.children,i)),n.push(a)}),n}var W=`get`,G=`application/x-www-form-urlencoded`;function K(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function ut(e){return K(e)&&e.tagName.toLowerCase()===`button`}function dt(e){return K(e)&&e.tagName.toLowerCase()===`form`}function ft(e){return K(e)&&e.tagName.toLowerCase()===`input`}function pt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function mt(e,t){return e.button===0&&(!t||t===`_self`)&&!pt(e)}var q=null;function ht(){if(q===null)try{new FormData(document.createElement(`form`),0),q=!1}catch{q=!0}return q}var gt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function J(e){return e!=null&&!gt.has(e)?(d(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${G}"`),null):e}function _t(e,t){let n,r,i,a,o;if(dt(e)){let o=e.getAttribute(`action`);r=o?D(o,t):null,n=e.getAttribute(`method`)||W,i=J(e.getAttribute(`enctype`))||G,a=new FormData(e)}else if(ut(e)||ft(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?D(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||W,i=J(e.getAttribute(`formenctype`))||J(o.getAttribute(`enctype`))||G,a=new FormData(o,e),!ht()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(K(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=W,r=null,i=G,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var vt={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},yt=/[&><\u2028\u2029]/g;function bt(e){return e.replace(yt,e=>vt[e])}function Y(e,t){if(e===!1||e==null)throw Error(t)}function xt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&D(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function St(e,t){if(e.id in t)return t[e.id];try{let n=await o(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ct(e){return e!=null&&typeof e.page==`string`}function wt(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Tt(e,t,n){return At((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await St(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(wt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Et(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Dt(e,t,{includeHydrateFallback:n}={}){return Ot(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Ot(e){return[...new Set(e)]}function kt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function At(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Ct(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(kt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function jt(){let e=s.useContext(M);return Y(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Mt(){let e=s.useContext(N);return Y(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var X=s.createContext(void 0);X.displayName=`FrameworkContext`;function Nt(){let e=s.useContext(X);return Y(e,`You must render this element inside a <HydratedRouter> element`),e}function Pt(e,t){let n=s.useContext(X),[r,i]=s.useState(!1),[a,o]=s.useState(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:f}=t,p=s.useRef(null);s.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),s.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let m=()=>{i(!0)},h=()=>{i(!1),o(!1)};return n?e===`intent`?[a,p,{onFocus:Z(c,m),onBlur:Z(l,h),onMouseEnter:Z(u,m),onMouseLeave:Z(d,h),onTouchStart:Z(f,m)}]:[a,p,{}]:[!1,p,{}]}function Z(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ft({page:e,...t}){let{router:n}=jt(),r=s.useMemo(()=>y(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?s.createElement(Lt,{page:e,matches:r,...t}):null}function It(e){let{manifest:t,routeModules:n}=Nt(),[r,i]=s.useState([]);return s.useEffect(()=>{let r=!1;return Tt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Lt({page:e,matches:t,...n}){let r=z(),{future:i,manifest:a,routeModules:o}=Nt(),{basename:c}=jt(),{loaderData:l,matches:u}=Mt(),d=s.useMemo(()=>Et(e,t,u,a,r,`data`),[e,t,u,a,r]),f=s.useMemo(()=>Et(e,t,u,a,r,`assets`),[e,t,u,a,r]),p=s.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!d.some(t=>t.route.id===e.route.id)&&e.route.id in l&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let u=xt(e,c,i.unstable_trailingSlashAwareDataRequests,`data`);return s&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[c,i.unstable_trailingSlashAwareDataRequests,l,r,a,d,t,e,o]),m=s.useMemo(()=>Dt(f,a),[f,a]),h=It(f);return s.createElement(s.Fragment,null,p.map(e=>s.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>s.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>s.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Rt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}s.Component;var zt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{zt&&(window.__reactRouterVersion=`7.13.0`)}catch{}function Bt({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=s.useRef();i.current??=l({window:r,v5Compat:!0});let a=i.current,[o,c]=s.useState({action:a.action,location:a.location}),u=s.useCallback(e=>{n===!1?c(e):s.startTransition(()=>c(e))},[n]);return s.useLayoutEffect(()=>a.listen(u),[a,u]),s.createElement(ct,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Vt({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=s.useState({action:n.action,location:n.location}),o=s.useCallback(e=>{r===!1?a(e):s.startTransition(()=>a(e))},[r]);return s.useLayoutEffect(()=>n.listen(o),[n,o]),s.createElement(ct,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Vt.displayName=`unstable_HistoryRouter`;var Ht=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Q=s.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,unstable_useTransitions:g}=s.useContext(P),_=typeof l==`string`&&Ht.test(l),v=Se(l,h);l=v.to;let y=Pe(l,{relative:r}),[b,x,S]=Pt(n,p),C=Yt(l,{replace:a,state:o,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:g});function w(t){e&&e(t),t.defaultPrevented||C(t)}let T=s.createElement(`a`,{...p,...S,href:v.absoluteURL||y,onClick:v.isExternal||i?e:w,ref:Rt(m,x),target:c,"data-discover":!_&&t===`render`?`true`:void 0});return b&&!_?s.createElement(s.Fragment,null,T,s.createElement(Ft,{page:y})):T});Q.displayName=`Link`;var Ut=s.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:c,...l},u){let d=V(a,{relative:l.relative}),f=z(),p=s.useContext(N),{navigator:m,basename:h}=s.useContext(P),g=p!=null&&an(d)&&o===!0,_=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=f.pathname,y=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;t||(v=v.toLowerCase(),y=y?y.toLowerCase():null,_=_.toLowerCase()),y&&h&&(y=D(y,h)||y);let b=_!==`/`&&_.endsWith(`/`)?_.length-1:_.length,x=v===_||!r&&v.startsWith(_)&&v.charAt(b)===`/`,S=y!=null&&(y===_||!r&&y.startsWith(_)&&y.charAt(_.length)===`/`),C={isActive:x,isPending:S,isTransitioning:g},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,g?`transitioning`:null].filter(Boolean).join(` `);let ee=typeof i==`function`?i(C):i;return s.createElement(Q,{...l,"aria-current":w,className:T,ref:u,style:ee,to:a,viewTransition:o},typeof c==`function`?c(C):c)});Ut.displayName=`NavLink`;var Wt=s.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=W,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p,...m},h)=>{let{unstable_useTransitions:g}=s.useContext(P),_=Qt(),v=$t(c,{relative:u}),y=o.toLowerCase()===`get`?`get`:`post`,b=typeof c==`string`&&Ht.test(c);return s.createElement(`form`,{ref:h,method:y,action:v,onSubmit:r?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,c=r?.getAttribute(`formmethod`)||o,m=()=>_(r||e.currentTarget,{fetcherKey:t,method:c,navigate:n,replace:i,state:a,relative:u,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:p});g&&n!==!1?s.startTransition(()=>m()):m()},...m,"data-discover":!b&&e===`render`?`true`:void 0})});Wt.displayName=`Form`;function Gt({getKey:e,storageKey:t,...n}){let r=s.useContext(X),{basename:i}=s.useContext(P),a=z(),o=et();nn({getKey:e,storageKey:t});let c=s.useMemo(()=>{if(!r||!e)return null;let t=tn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let l=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return s.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${l})(${bt(JSON.stringify(t||en))}, ${bt(JSON.stringify(c))})`}})}Gt.displayName=`ScrollRestoration`;function Kt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function qt(e){let t=s.useContext(M);return u(t,Kt(e)),t}function Jt(e){let t=s.useContext(N);return u(t,Kt(e)),t}function Yt(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=B(),d=z(),f=V(e,{relative:a});return s.useCallback(p=>{if(mt(p,t)){p.preventDefault();let t=n===void 0?h(d)===h(f):n,m=()=>u(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:c});l?s.startTransition(()=>m()):m()}},[d,u,f,n,r,t,e,i,a,o,c,l])}var Xt=0,Zt=()=>`__${String(++Xt)}__`;function Qt(){let{router:e}=qt(`useSubmit`),{basename:t}=s.useContext(P),n=Qe(),r=e.fetch,i=e.navigate;return s.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=_t(e,t);a.navigate===!1?await r(a.fetcherKey||Zt(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function $t(e,{relative:t}={}){let{basename:n}=s.useContext(P),r=s.useContext(I);u(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...V(e||`.`,{relative:t})},o=z();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:j([n,a.pathname])),h(a)}var en=`react-router-scroll-positions`,$={};function tn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:D(e.pathname,n)||e.pathname},t)),i??=e.key,i}function nn({getKey:e,storageKey:t}={}){let{router:n}=qt(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Jt(`useScrollRestoration`),{basename:a}=s.useContext(P),o=z(),c=et(),l=$e();s.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),rn(s.useCallback(()=>{if(l.state===`idle`){let t=tn(o,c,a,e);$[t]=window.scrollY}try{sessionStorage.setItem(t||en,JSON.stringify($))}catch(e){d(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,a,o,c,t])),typeof document<`u`&&(s.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||en);e&&($=JSON.parse(e))}catch{}},[t]),s.useLayoutEffect(()=>{let t=n?.enableScrollRestoration($,()=>window.scrollY,e?(t,n)=>tn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),s.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{d(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function rn(e,t){let{capture:n}=t||{};s.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function an(e,{relative:t}={}){let n=s.useContext(Ee);u(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=qt(`useViewTransitionState`),i=V(e,{relative:t});if(!n.isTransitioning)return!1;let a=D(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=D(n.nextLocation.pathname,r)||n.nextLocation.pathname;return E(i.pathname,o)!=null||E(i.pathname,a)!=null}var on=n(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]);export{ot as a,z as c,o as d,Ut as i,B as l,Bt as n,st as o,Q as r,lt as s,on as t,Re as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/doc-browser-p9DDNPWB.js","assets/doc-browser-rZIQIjuw.js","assets/i18n-D1144VAA.js","assets/createLucideIcon-DzY6wN61.js","assets/search-CRtQwr-h.js","assets/book-open-BcnAiKde.js","assets/external-link-CpEvG65F.js","assets/plus-B-YHtTNC.js","assets/x-BeyYA_h6.js","assets/doc-browser-context-FukQHvyo.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as e,i as t,m as n,p as r,r as i,u as a}from"./i18n-D1144VAA.js";import{Dt as o,Et as s,Lt as c,Nt as l,Ot as u,Tt as d,bt as f,gt as p,mt as m,pt as h,wt as g,yt as ee}from"./api-CKKNxbsy.js";import{d as _,i as v,t as y}from"./cpu-DPPwMzoC.js";import{t as b}from"./createLucideIcon-DzY6wN61.js";import{n as te,t as ne}from"./search-CRtQwr-h.js";import{t as re}from"./book-open-BcnAiKde.js";import{i as ie,k as ae,n as oe,r as x,t as se}from"./select-C2c10F3e.js";import{t as S}from"./download-CMM8po31.js";import{t as ce}from"./key-round-DUq47t0P.js";import{h as le,n as ue}from"./app-manager-provider-BM1hziPv.js";import{n as de,t as fe}from"./settings-MWL2SMyk.js";import{t as pe}from"./refresh-cw-CrbD8EkT.js";import{t as me}from"./sparkles-BmgOD4nY.js";import{t as he}from"./x-BeyYA_h6.js";import{i as ge}from"./doc-browser-context-FukQHvyo.js";import{n as _e}from"./doc-browser-CAhfnm0D.js";import{t as ve}from"./use-config-jAYudJxy.js";import{n as ye,r as be,t as xe}from"./popover-2H9DS7Cv.js";var C=b(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),w=b(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),T=b(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),E=b(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),D=b(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),O=b(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Se=b(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),Ce=b(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),we=b(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Te=b(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),k=b(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),A=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),Ee=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}A.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();A.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){A.setState({supported:!0,initialized:!0,busyAction:null}),c.error(`${i(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{A.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(i(`runtimePresenceLaunchAtLoginUnavailable`));A.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return A.setState({supported:!0,initialized:!0,snapshot:n}),c.success(i(`runtimePresenceSaved`)),n}catch(e){throw c.error(`${i(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{A.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:i(`error`)}},j=f(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null}));new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){j.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{j.setState({supported:!0,initialized:!0,snapshot:e})}),j.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();j.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){j.setState({supported:!0,initialized:!0}),c.error(`${i(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,i(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){c.success(i(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){c.success(i(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??i(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){c.success(i(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&c.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,i(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&c.success(i(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,i(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updatePreferences=async e=>{try{await this.runSnapshotCommand(`saving-preferences`,i(`desktopUpdatesPreferencesFailed`),async t=>await t.updatePreferences(e))}catch{return}},this.updateChannel=async e=>{if(j.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,i(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){c.success(i(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}c.success(i(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(i(`desktopUpdatesDesktopOnlyDescription`));j.setState({busyAction:e});try{let e=await n(r);return j.setState({snapshot:e}),e}catch(e){throw c.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{j.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:i(`error`),this.getChannelLabel=e=>i(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function De(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function Oe(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function ke(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function Ae(e){return[{target:`/chat`,label:e(`chat`),icon:D},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:T},{target:`/agents`,label:e(`agentsPageTitle`),icon:w},{target:`/settings`,label:e(`settings`),icon:fe}]}function je(e){return[{target:`/model`,label:e(`model`),icon:y},{target:`/providers`,label:e(`providers`),icon:me},{target:`/channels`,label:e(`channels`),icon:de},{target:`/search`,label:e(`searchChannels`),icon:ne},{target:`/runtime`,label:e(`runtime`),icon:y},{target:`/updates`,label:e(`updates`),icon:S},{target:`/remote`,label:e(`remote`),icon:Te},{target:`/security`,label:e(`security`),icon:Ce},{target:`/secrets`,label:e(`secrets`),icon:ce},{target:`/cron`,label:e(`cron`),icon:C},{target:`/marketplace/plugins`,label:e(`marketplaceFilterPlugins`),icon:Se},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:k}]}function M(e){return[{target:`/language`,label:e(`language`),icon:E},...je(e)]}function Me(e){let t=e.toLowerCase();return t===`/settings`?!0:M(e=>e).some(e=>De(t,e.target))}function Ne(e,t){let n=e.toLowerCase(),r=M(t);if(ke(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(De(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var Pe=`nextclaw.ui.theme`,N=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],P=`warm`,F=!1,I=new Set;function Fe(e){return e===`warm`||e===`cool`}function L(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function Ie(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(Pe);if(Fe(e))return e}catch{}return`warm`}function R(){return F||=(P=Ie(),L(P),!0),P}function Le(){return F?P:R()}function Re(e){if(R(),e!==P){if(P=e,L(P),typeof window<`u`)try{window.localStorage.setItem(Pe,P)}catch{}I.forEach(e=>e(P))}}function ze(e){return I.add(e),()=>{I.delete(e)}}var z=r(),Be={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function Ve(){let e=p(),t=e.actionLabel===i(`runtimeStatusRestartAction`),n=async()=>{if(t)try{let e=await ee.runRuntimeControlAction(`restart-service`);c.success(e.message)}catch(e){let t=e instanceof Error?e.message:i(`runtimeControlActionFailed`);c.error(`${i(`runtimeControlActionFailed`)}: ${t}`)}};return(0,z.jsxs)(xe,{children:[(0,z.jsx)(be,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,z.jsx)(`span`,{className:a(`h-2.5 w-2.5 rounded-full`,Be[e.tone])})})}),(0,z.jsxs)(ye,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,z.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,z.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,z.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:i(`runtimeStatusActionHint`)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void n(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?i(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}var B=e(n(),1);function V({className:e,density:t=`sidebar`,suffix:n}){let{data:r}=ve(),i=r?.name??`NextClaw`,o=r?.productVersion?.trim(),s=o?`v${o}`:null,c=n??(0,z.jsx)(Ve,{}),l=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,u=t===`chrome`;return(0,z.jsxs)(`div`,{className:a(e??`flex min-w-0 items-center gap-2`,l&&`pl-[58px]`),children:[(0,z.jsx)(`div`,{className:a(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,z.jsx)(`img`,{src:`/logo.svg`,alt:i,className:`h-full w-full object-contain`})}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,z.jsx)(`span`,{className:a(`shrink-0 font-semibold text-gray-800`,u?`text-[15px]`:`text-[14px]`),children:i}),s?(0,z.jsx)(He,{versionLabel:s,density:t}):null]}),(0,z.jsx)(Ue,{}),c?(0,z.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:c}):null]})]})}function He({versionLabel:e,density:t}){let[n,r]=(0,B.useState)(!1);return(0,z.jsxs)(`span`,{className:`relative min-w-0 flex-1`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),children:[(0,z.jsx)(`span`,{tabIndex:0,"aria-label":e,className:a(`block min-w-0 truncate font-medium text-gray-500 outline-none`,`text-[12px]`),children:e}),n?(0,z.jsx)(`span`,{className:`pointer-events-none absolute left-0 top-full z-[var(--z-tooltip)] mt-1 w-max max-w-none whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md`,children:e}):null]})}function Ue(){let{supported:e,busyAction:t,snapshot:n}=m();return!e||!n?null:n.status===`downloading`||n.status===`blocked`||n.status===`failed`?(0,z.jsx)(We,{snapshot:n}):n.status===`downloaded`?(0,z.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-emerald-50 px-2 text-[11px] font-semibold leading-none text-emerald-700 ring-1 ring-emerald-100 transition-colors hover:bg-emerald-100 disabled:opacity-70`,disabled:t===`applying`,onClick:()=>void h.applyDownloadedUpdate(),children:i(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)}):n.status===`update-available`?(0,z.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,disabled:t===`downloading`,onClick:()=>void h.downloadUpdate(),children:i(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)}):null}function We({snapshot:e}){if(e.status===`blocked`||e.status===`failed`)return(0,z.jsx)(Ge,{snapshot:e});let t=e.status===`downloading`?Ke(e):null;return t?(0,z.jsx)(`span`,{className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,title:i(`updates`),children:t}):null}function Ge({snapshot:e}){let t=e.status===`failed`?i(`desktopUpdatesStatusFailed`):i(`desktopUpdatesStatusBlocked`),n=e.recoveryCommand?.trim()||null,r=e.errorMessage?.trim()||e.blockReason?.trim()||null,a=[t,e.status===`blocked`&&e.blockReason?i(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,r,n].filter(Boolean).join(`
|
|
3
|
-
`);return(0,z.jsx)(`span`,{role:`img`,"aria-label":t,title:a,tabIndex:0,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-50 text-[13px] font-bold leading-none text-amber-700 ring-1 ring-amber-100`,children:`!`})}function Ke(e){let t=e.progress?.percent;return t==null?i(`desktopUpdatesInlineDownloading`):i(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var qe={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function H(e){return qe[e]}function U({to:e,label:t,icon:n,density:r=`default`,className:i}){let o=H(r);return(0,z.jsx)(v,{to:e,className:({isActive:e})=>a(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n,{className:a(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function W({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=H(r);return(0,z.jsxs)(`button`,{type:`button`,onClick:n,className:a(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,i),"data-testid":l,children:[(0,z.jsx)(t,{className:a(d.icon,`shrink-0 text-gray-400`)}),(0,z.jsx)(`span`,{className:a(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,z.jsx)(`span`,{className:a(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function G({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:o=`default`,children:s}){let c=H(o);return(0,z.jsxs)(se,{value:n,onValueChange:i,children:[(0,z.jsxs)(ie,{className:a(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,z.jsxs)(`div`,{className:a(`flex min-w-0 items-center`,c.gap),children:[(0,z.jsx)(t,{className:a(c.icon,`text-gray-400`)}),(0,z.jsx)(`span`,{className:`text-left`,children:e})]}),(0,z.jsx)(`span`,{className:a(`ml-auto text-gray-500`,c.value),children:r})]}),(0,z.jsx)(oe,{children:s})]})}var K=`nextclaw-pwa-install-banner-dismissed`,q=`nextclaw-pwa-install-banner-dismissed-until`;function Je(){let e=J();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Ze(e):!1}function Ye(){let e=J();e?.setItem(K,`1`),e?.removeItem(q)}function Xe(){let e=J();e?.removeItem(K),e?.removeItem(q)}function J(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ze(e){let t=e.getItem(q);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(q),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(K,`1`),!0)}function Qe(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:Je(),updateAvailable:!1,registrationFailed:!1}}var Y=f(()=>Qe()),X=`nextclaw-pwa-dev-sw-reset`,Z=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{Y.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){Y.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;Y.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:Y.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(X,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(X)}catch{}}}},Q=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),Y.setState(Qe())},this.refreshState=()=>{let e=this.resolveInstallability();Y.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:Je()})),Z.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Ye(),Y.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(Xe(),this.refreshState(),c.success(i(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,Xe(),Y.setState({dismissedInstallPrompt:!0}),c.success(i(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function $e(){let e=Y(e=>e.installability);return(0,z.jsx)(`span`,{className:a(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:et(e)})}function et(e){return i(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function tt(e,t,n){return i(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function nt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.blockedReason);return(0,z.jsxs)(g,{children:[(0,z.jsxs)(o,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(u,{children:i(`pwaInstallTitle`)}),(0,z.jsx)(s,{children:i(`pwaInstallDescription`)})]}),(0,z.jsx)($e,{})]}),(0,z.jsxs)(d,{className:`space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:tt(e,t,n)})}),e===`available`&&t===`prompt`?(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(`p`,{className:`text-sm text-gray-500`,children:i(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,z.jsx)(we,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallManualHint`)})]}):null]})]})}function rt(){let e=Y(e=>e.installability),t=Y(e=>e.installMethod),n=Y(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,z.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaInstallBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallBannerDescription`)})]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":i(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Q.dismissInstallPrompt()},children:(0,z.jsx)(he,{className:`h-4 w-4`})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,z.jsx)(S,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,z.jsx)(l,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Q.dismissInstallPrompt()},children:i(`pwaInstallDismiss`)})]})]})}function it(){let e=Y(e=>e.updateAvailable),t=Y(e=>e.installability);return!e||t!==`installed`?null:(0,z.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,z.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaUpdateBannerTitle`)}),(0,z.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaUpdateBannerDescription`)})]})}),(0,z.jsx)(`div`,{className:`mt-4`,children:(0,z.jsxs)(l,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Z.applyUpdate()},children:[(0,z.jsx)(pe,{className:`h-4 w-4`}),i(`pwaUpdateAction`)]})})]})}var $=!1;function at(){$||typeof window>`u`||($=!0,Q.start(),Z.start())}var ot={warm:`#F9F8F5`,cool:`#F8FAFB`},st=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=ot[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},ct=(0,B.createContext)(null);function lt({children:e}){let[t,n]=(0,B.useState)(()=>R());(0,B.useEffect)(()=>{st.syncTheme(t),window.nextclawDesktop?.setShellTheme?.(t)},[t]),(0,B.useEffect)(()=>ze(e=>{n(e)}),[]);let r=(0,B.useCallback)(e=>{Re(e),n(Le())},[]),i=(0,B.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,z.jsx)(ct.Provider,{value:i,children:e})}function ut(){let e=(0,B.useContext)(ct);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function dt(){let{language:e,setLanguage:n}=_e();return{currentLanguage:e,currentLanguageLabel:t.find(t=>t.value===e)?.label??e,languageOptions:t,selectLanguage:(0,B.useCallback)(t=>{e!==t&&(n(t),window.location.reload())},[e,n])}}function ft(){let{currentLanguage:e,currentLanguageLabel:t,languageOptions:n,selectLanguage:r}=dt();return(0,z.jsxs)(`section`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[(0,z.jsx)(`div`,{className:`rounded-3xl border border-gray-200/80 bg-white p-5 shadow-card`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,z.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,z.jsx)(E,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:i(`language`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t})]})]})}),(0,z.jsx)(`div`,{className:`overflow-hidden rounded-3xl border border-gray-200/80 bg-white shadow-card`,children:n.map(t=>{let n=t.value===e;return(0,z.jsxs)(`button`,{type:`button`,onClick:()=>r(t.value),className:a(`flex w-full items-center justify-between gap-3 border-b border-gray-100 px-5 py-4 text-left text-sm transition-colors last:border-b-0`,n?`bg-gray-50 text-gray-900`:`text-gray-700 hover:bg-gray-50/70`),"aria-current":n?`true`:void 0,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:t.label}),n?(0,z.jsx)(ae,{className:`h-4 w-4 text-gray-700`}):null]},t.value)})})]})}function pt({mode:e}){let t=ue(),n=ge(),r=le(),{currentLanguage:o,currentLanguageLabel:s,languageOptions:c,selectLanguage:l}=dt(),{theme:u,setTheme:d}=ut(),f=e===`settings`,p=i(N.find(e=>e.value===u)?.labelKey??`themeWarm`),m=r.data?.account.email?.trim(),h=!!r.data?.account.loggedIn,g=e=>{u!==e&&d(e)},ee=[{target:`/chat`,label:i(`chat`),icon:D},{target:`/chat/cron`,label:i(`cron`),icon:C},{target:`/chat/skills`,label:i(`marketplaceFilterSkills`),icon:T},{target:`/agents`,label:i(`agentsPageTitle`),icon:w}],_=je(i),y=f?_:ee,b=f?`compact`:`default`;return(0,z.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[f?(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,z.jsxs)(v,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,z.jsx)(te,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,z.jsx)(`span`,{className:`truncate`,children:i(`backToMain`)})]}),(0,z.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,z.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:i(`settings`)})]})}):(0,z.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,z.jsx)(V,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,z.jsx)(`ul`,{className:a(f?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:y.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsx)(U,{to:e.target,label:e.label,icon:e.icon,density:b})},e.target))})}),(0,z.jsxs)(`div`,{className:a(`shrink-0 border-t border-[#dde0ea] bg-secondary`,f?`mt-2 pt-3`:`mt-3 pt-3`),children:[f?(0,z.jsx)(W,{onClick:()=>t.accountManager.openAccountPanel(),icon:ce,label:i(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:h?m||i(`remoteAccountEntryConnected`):i(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(U,{to:`/settings`,label:i(`settings`),icon:fe})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:u,onValueChange:e=>g(e),icon:O,label:i(`theme`),valueLabel:p,density:b,children:N.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:i(e.labelKey)},e.value))})}),(0,z.jsx)(`div`,{className:`mb-2`,children:(0,z.jsx)(G,{value:o,onValueChange:e=>l(e),icon:E,label:i(`language`),valueLabel:s,density:b,children:c.map(e=>(0,z.jsx)(x,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,z.jsx)(W,{onClick:()=>n.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:re,label:i(`docBrowserHelp`),density:b})]})]})]})}function mt(){return(0,z.jsxs)(`header`,{className:`flex h-[var(--desktop-titlebar-height)] shrink-0 bg-secondary`,"data-testid":`desktop-window-chrome`,children:[(0,z.jsxs)(`div`,{className:`desktop-window-drag flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary pl-4 pr-3 text-secondary-foreground`,"data-testid":`desktop-window-chrome-sidebar`,children:[(0,z.jsx)(`div`,{className:`desktop-window-no-drag flex min-w-0 shrink-0 items-center`,children:(0,z.jsx)(V,{className:`flex min-w-0 items-center gap-2.5`,density:`chrome`})}),(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`,"aria-hidden":`true`})]}),(0,z.jsx)(`div`,{className:`desktop-window-drag mr-[var(--desktop-caption-safe-right)] flex min-w-0 flex-1 items-center border-b border-[#ebe7dc]/80 bg-secondary`,"aria-hidden":`true`,"data-testid":`desktop-window-chrome-main`,children:(0,z.jsx)(`div`,{className:`min-w-0 flex-1 self-stretch`})})]})}function ht(){return typeof window>`u`?null:vt()??window.nextclawDesktop?.platform??null}function gt(){return ht()===`darwin`}function _t(){return ht()===`win32`}function vt(){return null}var yt=(0,B.lazy)(async()=>({default:(await _(async()=>{let{DocBrowser:e}=await import(`./doc-browser-p9DDNPWB.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function bt(e){return{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":e?`280px`:`240px`}}function xt({pathname:e,isDocBrowserOpen:t,docBrowserMode:n,children:r}){let i=Oe(e),o=_t();return(0,z.jsxs)(`div`,{className:a(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,o?`rounded-[10px]`:null),style:o?bt(i):void 0,children:[o?(0,z.jsx)(mt,{}):null,(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[!i&&(0,z.jsx)(pt,{mode:`settings`}),(0,z.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,z.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:i?(0,z.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:r}):(0,z.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,z.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:r})})}),t&&n===`docked`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})]}),t&&n===`floating`?(0,z.jsx)(B.Suspense,{fallback:null,children:(0,z.jsx)(yt,{})}):null]})}export{O as C,w as D,T as E,C as O,k as S,E as T,Oe as _,lt as a,Ee as b,rt as c,U as d,V as f,ke as g,M as h,ft as i,nt as l,Ae as m,gt as n,ut as o,N as p,_t as r,at as s,xt as t,it as u,Me as v,D as w,A as x,Ne as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./doc-browser-rZIQIjuw.js";export{e as DocBrowser};
|