@brett_lamy/ui 5.15.0 → 5.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/call-stack.d.ts +26 -0
- package/dist/components/call-stack.d.ts.map +1 -0
- package/dist/components/call-stack.js +236 -0
- package/dist/components/code-editor-window.d.ts +191 -0
- package/dist/components/code-editor-window.d.ts.map +1 -0
- package/dist/components/code-editor-window.js +1474 -0
- package/dist/components/code-editor.d.ts +213 -0
- package/dist/components/code-editor.d.ts.map +1 -0
- package/dist/components/code-editor.js +484 -0
- package/dist/components/debug-toolbar.d.ts +13 -0
- package/dist/components/debug-toolbar.d.ts.map +1 -0
- package/dist/components/debug-toolbar.js +85 -0
- package/dist/components/file-upload.d.ts +1 -1
- package/dist/components/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload.js +1 -1
- package/dist/components/filter-input.d.ts +1 -1
- package/dist/components/filter-input.d.ts.map +1 -1
- package/dist/components/filter-input.js +1 -1
- package/dist/components/filter.d.ts +1 -1
- package/dist/components/filter.d.ts.map +1 -1
- package/dist/components/filter.js +1 -1
- package/dist/components/log-list.d.ts +95 -0
- package/dist/components/log-list.d.ts.map +1 -0
- package/dist/components/log-list.js +549 -0
- package/dist/components/object-tree.d.ts +30 -0
- package/dist/components/object-tree.d.ts.map +1 -0
- package/dist/components/object-tree.js +415 -0
- package/dist/components/object-value.d.ts +13 -0
- package/dist/components/object-value.d.ts.map +1 -0
- package/dist/components/object-value.js +69 -0
- package/dist/components/request-table.d.ts +78 -0
- package/dist/components/request-table.d.ts.map +1 -0
- package/dist/components/request-table.js +697 -0
- package/dist/components/spreadsheet.d.ts +1 -1
- package/dist/components/spreadsheet.d.ts.map +1 -1
- package/dist/components/spreadsheet.js +1 -1
- package/dist/components/syntax-highlighting.d.ts +45 -77
- package/dist/components/syntax-highlighting.d.ts.map +1 -1
- package/dist/components/syntax-highlighting.js +36 -275
- package/dist/components/terminal.d.ts +62 -0
- package/dist/components/terminal.d.ts.map +1 -0
- package/dist/components/terminal.js +172 -0
- package/dist/components/trace-timeline.d.ts +97 -0
- package/dist/components/trace-timeline.d.ts.map +1 -0
- package/dist/components/trace-timeline.js +850 -0
- package/dist/components/tree.d.ts.map +1 -1
- package/dist/components/tree.js +99 -91
- package/dist/components/video-preview.d.ts +1 -1
- package/dist/components/video-preview.d.ts.map +1 -1
- package/dist/components/video-preview.js +1 -1
- package/dist/components/video-timeline.d.ts +1 -1
- package/dist/components/video-timeline.d.ts.map +1 -1
- package/dist/components/video-timeline.js +1 -1
- package/dist/components/workspace.d.ts.map +1 -1
- package/dist/components/workspace.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +47 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +120 -100
- package/dist/lib/call-stack-model.d.ts +75 -0
- package/dist/lib/call-stack-model.d.ts.map +1 -0
- package/dist/lib/call-stack-model.js +114 -0
- package/dist/lib/code-document.d.ts +229 -0
- package/dist/lib/code-document.d.ts.map +1 -0
- package/dist/lib/code-document.js +727 -0
- package/dist/lib/code-editor-gpu.d.ts +9 -0
- package/dist/lib/code-editor-gpu.d.ts.map +1 -0
- package/dist/lib/code-editor-gpu.js +23 -0
- package/dist/lib/code-editor-model.d.ts +371 -0
- package/dist/lib/code-editor-model.d.ts.map +1 -0
- package/dist/lib/code-editor-model.js +1105 -0
- package/dist/lib/{file-upload.d.ts → file-upload-model.d.ts} +1 -1
- package/dist/lib/file-upload-model.d.ts.map +1 -0
- package/dist/lib/{file-upload.js → file-upload-model.js} +1 -1
- package/dist/lib/{filter.d.ts → filter-model.d.ts} +1 -1
- package/dist/lib/filter-model.d.ts.map +1 -0
- package/dist/lib/{filter.js → filter-model.js} +1 -1
- package/dist/lib/filter-query.d.ts +1 -1
- package/dist/lib/filter-query.d.ts.map +1 -1
- package/dist/lib/filter-query.js +1 -1
- package/dist/lib/log-list-model.d.ts +132 -0
- package/dist/lib/log-list-model.d.ts.map +1 -0
- package/dist/lib/log-list-model.js +214 -0
- package/dist/lib/log-list-window.d.ts +121 -0
- package/dist/lib/log-list-window.d.ts.map +1 -0
- package/dist/lib/log-list-window.js +245 -0
- package/dist/lib/object-tree-model.d.ts +162 -0
- package/dist/lib/object-tree-model.d.ts.map +1 -0
- package/dist/lib/object-tree-model.js +347 -0
- package/dist/lib/object-tree-value.d.ts +139 -0
- package/dist/lib/object-tree-value.d.ts.map +1 -0
- package/dist/lib/object-tree-value.js +410 -0
- package/dist/lib/request-table-model.d.ts +85 -0
- package/dist/lib/request-table-model.d.ts.map +1 -0
- package/dist/lib/request-table-model.js +105 -0
- package/dist/lib/{spreadsheet.d.ts → spreadsheet-model.d.ts} +1 -1
- package/dist/lib/spreadsheet-model.d.ts.map +1 -0
- package/dist/lib/{spreadsheet.js → spreadsheet-model.js} +1 -1
- package/dist/lib/syntax.d.ts +19 -7
- package/dist/lib/syntax.d.ts.map +1 -1
- package/dist/lib/syntax.js +54 -50
- package/dist/lib/terminal-line.d.ts +155 -0
- package/dist/lib/terminal-line.d.ts.map +1 -0
- package/dist/lib/terminal-line.js +463 -0
- package/dist/lib/trace-timeline-draw.d.ts +109 -0
- package/dist/lib/trace-timeline-draw.d.ts.map +1 -0
- package/dist/lib/trace-timeline-draw.js +252 -0
- package/dist/lib/trace-timeline-model.d.ts +324 -0
- package/dist/lib/trace-timeline-model.d.ts.map +1 -0
- package/dist/lib/trace-timeline-model.js +510 -0
- package/dist/lib/video-render.d.ts +1 -1
- package/dist/lib/video-render.d.ts.map +1 -1
- package/dist/lib/video-render.js +1 -1
- package/dist/lib/{video-timeline.d.ts → video-timeline-model.d.ts} +1 -1
- package/dist/lib/video-timeline-model.d.ts.map +1 -0
- package/dist/lib/{video-timeline.js → video-timeline-model.js} +1 -1
- package/package.json +5 -1
- package/dist/lib/file-upload.d.ts.map +0 -1
- package/dist/lib/filter.d.ts.map +0 -1
- package/dist/lib/spreadsheet.d.ts.map +0 -1
- package/dist/lib/video-timeline.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spreadsheet.d.ts","sourceRoot":"","sources":["../../src/components/spreadsheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAEoC,KAAK,cAAc,EAAyC,KAAK,SAAS,EAAE,KAAK,GAAG,EAC9H,MAAM,OAAO,CAAC;AAEf,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAEsB,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAC/F,MAAM,
|
|
1
|
+
{"version":3,"file":"spreadsheet.d.ts","sourceRoot":"","sources":["../../src/components/spreadsheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAEoC,KAAK,cAAc,EAAyC,KAAK,SAAS,EAAE,KAAK,GAAG,EAC9H,MAAM,OAAO,CAAC;AAEf,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAEsB,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAC/F,MAAM,yBAAyB,CAAC;AAcjC,eAAO,MAAM,mBAAmB;;8EAS/B,CAAC;AAUF,4FAA4F;AAC5F,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,eAAe,CAAC;CACxB;AACD,+DAA+D;AAC/D,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,KAAK,EAAE,gBAAgB,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,oFAAoF;IACpF,MAAM,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,eAAe,KAAK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AE,MAAe,EAAE,UAAyB,EACvH,UAAiB,EAAE,MAAM,EAAE,MAAa,EAAE,OAAO,EAAE,WAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EACpG,YAAY,EAAE,SAAyB,EAAE,GAAG,KAAK,EAClD,EAAE,gBAAgB,2CA4hBlB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cn as e } from "../lib/utils.js";
|
|
3
3
|
import { Icon as t } from "../lib/icon.js";
|
|
4
4
|
import { parseCsv as n, stringifyCsv as r } from "../lib/csv.js";
|
|
5
|
-
import { GPU_MIN_ROWS as i, columnHistogram as a, columnNumbers as o, inferColumnType as s, selectionStats as ee, sortRows as te } from "../lib/spreadsheet.js";
|
|
5
|
+
import { GPU_MIN_ROWS as i, columnHistogram as a, columnNumbers as o, inferColumnType as s, selectionStats as ee, sortRows as te } from "../lib/spreadsheet-model.js";
|
|
6
6
|
import { useCallback as c, useEffect as ne, useId as re, useImperativeHandle as ie, useLayoutEffect as ae, useMemo as l, useRef as u, useState as d } from "react";
|
|
7
7
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
8
|
import { Button as oe, Input as se } from "react-aria-components";
|
|
@@ -1,91 +1,51 @@
|
|
|
1
|
-
import { ComponentProps,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { SyntaxEngine
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
/** `auto` (default): gpu-lexer on a hardware WebGPU adapter; where the only adapter is a software one
|
|
12
|
-
(SwiftShader in headless CI, llvmpipe), there is none, or the one-time adapter probe takes over 2.5 s, the
|
|
13
|
-
small fallback at once. `gpu`: gpu-lexer on any adapter, software included (slow on software; the fallback
|
|
14
|
-
only where WebGPU is missing). `fallback`: always the fallback (tests, or pages that must not touch the GPU). */
|
|
15
|
-
engine?: SyntaxEngine;
|
|
16
|
-
}
|
|
17
|
-
export interface SyntaxTokensState {
|
|
18
|
-
/** One token array per line (a single trailing newline is dropped). Plain until the lexer answers. */
|
|
19
|
-
lines: SyntaxToken[][];
|
|
20
|
-
/** `gpu`, `fallback` (no WebGPU), `pending` (plain text shown) or `none` (not lexed). */
|
|
21
|
-
highlighter: SyntaxHighlighter;
|
|
22
|
-
}
|
|
23
|
-
/** Lines of tokens for `code`, lexed on the GPU through the page's shared gpu-lexer. Returns plain lines at once
|
|
24
|
-
and highlighted lines when ready; results are cached by source, so remounts and repeats are instant. While a
|
|
25
|
-
source grows (streaming), the tokens of its unchanged lines are kept until the new result lands. */
|
|
26
|
-
export declare function useSyntaxTokens(code: string, { language, enabled, engine }?: UseSyntaxTokensOptions): SyntaxTokensState;
|
|
27
|
-
/** One line's tokens as spans with `bl-tok-<type>` classes (plain text stays a text node). */
|
|
28
|
-
export declare function SyntaxTokens({ tokens }: {
|
|
29
|
-
tokens: readonly SyntaxToken[];
|
|
30
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
/** A line number, an inclusive `[from, to]` pair, or a string like `"3-5"` / `"3"`. */
|
|
32
|
-
export type SyntaxLineRange = number | readonly [number, number] | string;
|
|
1
|
+
import { ComponentProps, ReactNode, Ref } from 'react';
|
|
2
|
+
import { SyntaxTokens, useSyntaxTokens, CodeEditorContentProps, CodeEditorCopyButtonProps, CodeEditorHandle, SyntaxTokensState, UseSyntaxTokensOptions } from './code-editor';
|
|
3
|
+
import { CodeLineRange } from '../lib/code-editor-model';
|
|
4
|
+
import { SyntaxEngine } from '../lib/syntax';
|
|
5
|
+
export { SyntaxTokens, useSyntaxTokens };
|
|
6
|
+
export type { SyntaxTokensState, UseSyntaxTokensOptions };
|
|
7
|
+
/** @deprecated Use `CodeLineRange`. */
|
|
8
|
+
export type SyntaxLineRange = CodeLineRange;
|
|
9
|
+
/** @deprecated Use `codeEditorVariants`. */
|
|
33
10
|
export declare const syntaxHighlightingVariants: (props?: ({
|
|
34
11
|
variant?: "default" | "inline" | "ghost" | null | undefined;
|
|
35
12
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
/** @deprecated Use `useCodeEditor`, whose `getValue()` is the text as it is now. The enclosing SyntaxHighlighting's `code`, `language`, `variant`, `title` and `engine`. */
|
|
14
|
+
export declare function useSyntaxHighlighting(): {
|
|
38
15
|
code: string;
|
|
39
|
-
language
|
|
40
|
-
variant:
|
|
41
|
-
title
|
|
42
|
-
engine
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
export
|
|
46
|
-
export interface SyntaxHighlightingContentProps extends Omit<ComponentProps<'pre'>, 'children'> {
|
|
16
|
+
language: string | undefined;
|
|
17
|
+
variant: "default" | "inline" | "ghost";
|
|
18
|
+
title: ReactNode;
|
|
19
|
+
engine: SyntaxEngine | undefined;
|
|
20
|
+
} | null;
|
|
21
|
+
/** @deprecated Use `CodeEditorContentProps`. */
|
|
22
|
+
export interface SyntaxHighlightingContentProps extends Omit<CodeEditorContentProps, 'value' | 'lineNumbers' | 'highlight' | 'tabSize' | 'lineHeight'> {
|
|
47
23
|
/** Defaults to the enclosing SyntaxHighlighting's `code`. */
|
|
48
24
|
code?: string;
|
|
49
|
-
language?: string;
|
|
50
25
|
/** Show a line-number gutter (numbers are drawn with CSS, so they aren't copied). */
|
|
51
26
|
lineNumbers?: boolean;
|
|
52
|
-
/** Number of the first line. Line ranges use these displayed numbers. */
|
|
53
|
-
startLine?: number;
|
|
54
|
-
/** Lines to highlight: `[3, [7, 9], '12-14']`. */
|
|
55
|
-
highlightLines?: readonly SyntaxLineRange[];
|
|
56
|
-
/** Lines shown as added (green, `+`) … */
|
|
57
|
-
addedLines?: readonly SyntaxLineRange[];
|
|
58
|
-
/** … and removed (red, `−`). Either one adds a diff-sign column. */
|
|
59
|
-
removedLines?: readonly SyntaxLineRange[];
|
|
60
|
-
/** Soft-wrap long lines instead of scrolling sideways. */
|
|
61
|
-
wrap?: boolean;
|
|
62
|
-
/** Cap the height; the block scrolls past it. */
|
|
63
|
-
maxHeight?: number | string;
|
|
64
|
-
/** Extra attributes per line (e.g. `id` anchors, `onClick`, `data-*`). */
|
|
65
|
-
lineProps?: (line: number) => HTMLAttributes<HTMLSpanElement> | undefined;
|
|
66
27
|
/** `false` renders plain text and never lexes. */
|
|
67
28
|
highlight?: boolean;
|
|
68
|
-
/** `auto` (default: GPU on a hardware adapter, else the fallback at once), `gpu` (gpu-lexer even on a software
|
|
69
|
-
adapter) or `fallback` — see `useSyntaxTokens`. */
|
|
70
|
-
engine?: SyntaxEngine;
|
|
71
29
|
}
|
|
72
|
-
|
|
73
|
-
export declare function
|
|
74
|
-
|
|
75
|
-
export
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
export
|
|
84
|
-
|
|
30
|
+
/** @deprecated Use `CodeEditorContent`. */
|
|
31
|
+
export declare function SyntaxHighlightingContent({ code, ...props }: SyntaxHighlightingContentProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
/** @deprecated Use `CodeEditorHeader`. */
|
|
33
|
+
export declare function SyntaxHighlightingHeader(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
/** @deprecated Use `CodeEditorTitle`. */
|
|
35
|
+
export declare function SyntaxHighlightingTitle(props: ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
/** @deprecated Use `CodeEditorCopyButtonProps`. */
|
|
37
|
+
export type SyntaxHighlightingCopyButtonProps = CodeEditorCopyButtonProps;
|
|
38
|
+
/** @deprecated Use `CodeEditorCopyButton`. */
|
|
39
|
+
export declare function SyntaxHighlightingCopyButton(props: SyntaxHighlightingCopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
/** @deprecated Use `CodeEditorProps`. */
|
|
41
|
+
export interface SyntaxHighlightingProps extends Omit<ComponentProps<'div'>, 'title' | 'ref'> {
|
|
42
|
+
ref?: Ref<CodeEditorHandle>;
|
|
85
43
|
code: string;
|
|
86
44
|
/** Language id (`ts`, `tsx`, `json`, `css`, `bash`, `diff`, …). Shown in the header; `text` disables lexing.
|
|
87
45
|
gpu-lexer detects the language on its own. */
|
|
88
46
|
language?: string;
|
|
47
|
+
/** A card, no chrome, or an inline `<code>` span. */
|
|
48
|
+
variant?: 'default' | 'ghost' | 'inline';
|
|
89
49
|
/** Header title, usually a filename. */
|
|
90
50
|
title?: ReactNode;
|
|
91
51
|
/** Show a copy button (in the header, or floating top-right when there is no title). */
|
|
@@ -94,9 +54,17 @@ export interface SyntaxHighlightingProps extends Omit<ComponentProps<'div'>, 'ti
|
|
|
94
54
|
appearance?: 'light' | 'dark';
|
|
95
55
|
/** Class for the inner `<pre>`. */
|
|
96
56
|
contentClassName?: string;
|
|
57
|
+
lineNumbers?: boolean;
|
|
58
|
+
startLine?: number;
|
|
59
|
+
highlightLines?: readonly CodeLineRange[];
|
|
60
|
+
addedLines?: readonly CodeLineRange[];
|
|
61
|
+
removedLines?: readonly CodeLineRange[];
|
|
62
|
+
wrap?: boolean;
|
|
63
|
+
maxHeight?: number | string;
|
|
64
|
+
lineProps?: CodeEditorContentProps['lineProps'];
|
|
65
|
+
highlight?: boolean;
|
|
66
|
+
engine?: SyntaxEngine;
|
|
97
67
|
}
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
export declare function SyntaxHighlighting({ code, language, title, showCopy, variant, appearance, className, contentClassName, style, children, lineNumbers, startLine, highlightLines, addedLines, removedLines, wrap, maxHeight, lineProps, highlight, engine, ...props }: SyntaxHighlightingProps): import("react/jsx-runtime").JSX.Element;
|
|
101
|
-
export {};
|
|
68
|
+
/** @deprecated Use `CodeEditor` with `readOnly`. */
|
|
69
|
+
export declare function SyntaxHighlighting({ code, ...props }: SyntaxHighlightingProps): import("react/jsx-runtime").JSX.Element;
|
|
102
70
|
//# sourceMappingURL=syntax-highlighting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-highlighting.d.ts","sourceRoot":"","sources":["../../src/components/syntax-highlighting.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"syntax-highlighting.d.ts","sourceRoot":"","sources":["../../src/components/syntax-highlighting.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EACmF,YAAY,EAAqC,eAAe,EACxJ,KAAK,sBAAsB,EAAE,KAAK,yBAAyB,EAAE,KAAK,gBAAgB,EAAwB,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAC9J,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,CAAC;AAE1D,uCAAuC;AACvC,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC;AAE5C,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B;;8EAAqB,CAAC;AAE7D,4KAA4K;AAC5K,wBAAgB,qBAAqB;UAID,MAAM;;;;;SAGzC;AAED,gDAAgD;AAChD,MAAM,WAAW,8BAA+B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,GAAG,YAAY,CAAC;IACpJ,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,2CAA2C;AAC3C,wBAAgB,yBAAyB,CAAC,EAAE,IAAI,EAAE,GAAG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,WAAW,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,oDAAoD;AACpD,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAG7E"}
|
|
@@ -1,293 +1,54 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createContext as c, memo as l, useContext as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
6
|
-
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
7
|
-
import { Button as v, composeRenderProps as y } from "react-aria-components";
|
|
8
|
-
import { cva as b } from "class-variance-authority";
|
|
2
|
+
import { CodeEditor as e, CodeEditorContent as t, CodeEditorCopyButton as n, CodeEditorHeader as r, CodeEditorTitle as i, codeEditorVariants as a, useCodeEditor as o } from "./code-editor.js";
|
|
3
|
+
import { useMemo as s } from "react";
|
|
4
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
9
5
|
//#region src/components/syntax-highlighting.tsx
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (u) return;
|
|
25
|
-
let t = (t) => _((n) => n.code === e && n.engine === l && n.result === t ? n : {
|
|
26
|
-
code: e,
|
|
27
|
-
engine: l,
|
|
28
|
-
result: t
|
|
29
|
-
});
|
|
30
|
-
if (p) {
|
|
31
|
-
t(r(e));
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
let n = !0, o = a(e, l);
|
|
35
|
-
return o ? t(o) : i(e, l).then((e) => {
|
|
36
|
-
n && t(e);
|
|
37
|
-
}), () => {
|
|
38
|
-
n = !1;
|
|
39
|
-
};
|
|
40
|
-
}, [
|
|
41
|
-
e,
|
|
42
|
-
u,
|
|
43
|
-
p,
|
|
44
|
-
l
|
|
45
|
-
]);
|
|
46
|
-
let b = v?.spans ?? null;
|
|
47
|
-
return {
|
|
48
|
-
lines: f(() => o(e, b), [e, b]),
|
|
49
|
-
highlighter: u ? "none" : v && !y ? v.highlighter : "pending"
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function S({ tokens: e }) {
|
|
53
|
-
return /* @__PURE__ */ g(h, { children: e.map((e, t) => e.type === "plain" ? e.text : /* @__PURE__ */ g("span", {
|
|
54
|
-
className: "bl-tok bl-tok-" + e.type,
|
|
55
|
-
children: e.text
|
|
56
|
-
}, t)) });
|
|
57
|
-
}
|
|
58
|
-
function C(e) {
|
|
59
|
-
let t = /* @__PURE__ */ new Set();
|
|
60
|
-
for (let n of e ?? []) {
|
|
61
|
-
let e, r;
|
|
62
|
-
if (typeof n == "number") e = r = n;
|
|
63
|
-
else if (typeof n == "string") {
|
|
64
|
-
let [t, i] = n.split(/\s*[-–:]\s*/).map(Number);
|
|
65
|
-
e = t, r = Number.isFinite(i) ? i : t;
|
|
66
|
-
} else [e, r] = n;
|
|
67
|
-
if (!Number.isFinite(e) || !Number.isFinite(r)) continue;
|
|
68
|
-
let i = Math.min(e, r), a = Math.min(Math.max(e, r), i + 1e5);
|
|
69
|
-
for (let e = i; e <= a; e++) t.add(e);
|
|
70
|
-
}
|
|
71
|
-
return t;
|
|
72
|
-
}
|
|
73
|
-
var w = b("bl-syntax", {
|
|
74
|
-
variants: { variant: {
|
|
75
|
-
default: "bl-syntax-card",
|
|
76
|
-
ghost: "bl-syntax-ghost",
|
|
77
|
-
inline: "bl-syntax-inline"
|
|
78
|
-
} },
|
|
79
|
-
defaultVariants: { variant: "default" }
|
|
80
|
-
}), T = c(null), E = () => u(T), D = 200;
|
|
81
|
-
function O({ code: t, language: n, lineNumbers: r = !1, startLine: i = 1, highlightLines: a, addedLines: o, removedLines: s, wrap: c = !1, maxHeight: l, lineProps: d, highlight: p = !0, engine: m, className: h, style: _, tabIndex: v, ...y }) {
|
|
82
|
-
let b = u(T), S = t ?? b?.code ?? "", w = n ?? b?.language, E = m ?? b?.engine, { lines: O, highlighter: A } = x(S, {
|
|
83
|
-
language: w,
|
|
84
|
-
enabled: p,
|
|
85
|
-
engine: E
|
|
86
|
-
}), j = JSON.stringify([
|
|
87
|
-
a ?? null,
|
|
88
|
-
o ?? null,
|
|
89
|
-
s ?? null
|
|
90
|
-
]), M = f(() => {
|
|
91
|
-
let [e, t, n] = JSON.parse(j);
|
|
92
|
-
return {
|
|
93
|
-
hl: C(e),
|
|
94
|
-
add: C(t),
|
|
95
|
-
del: C(n)
|
|
96
|
-
};
|
|
97
|
-
}, [j]), N = M.add.size > 0 || M.del.size > 0, P = i + O.length - 1, F = [];
|
|
98
|
-
if (O.length > 400) for (let e = 0; e < O.length; e += D) F.push([e, Math.min(O.length, e + D)]);
|
|
99
|
-
return /* @__PURE__ */ g("pre", {
|
|
6
|
+
var l = a;
|
|
7
|
+
function u() {
|
|
8
|
+
let e = o(), t = e?.getValue();
|
|
9
|
+
return s(() => e ? {
|
|
10
|
+
code: t,
|
|
11
|
+
language: e.language,
|
|
12
|
+
variant: e.variant,
|
|
13
|
+
title: e.title,
|
|
14
|
+
engine: e.engine
|
|
15
|
+
} : null, [t, e]);
|
|
16
|
+
}
|
|
17
|
+
function d({ code: e, ...n }) {
|
|
18
|
+
return /* @__PURE__ */ c(t, {
|
|
19
|
+
value: e,
|
|
100
20
|
"data-slot": "syntax-highlighting-content",
|
|
101
|
-
|
|
102
|
-
"data-engine": E && E !== "auto" ? E : void 0,
|
|
103
|
-
"data-language": w,
|
|
104
|
-
"data-wrap": c || void 0,
|
|
105
|
-
"data-line-numbers": r || void 0,
|
|
106
|
-
"data-diff": N || void 0,
|
|
107
|
-
tabIndex: v ?? 0,
|
|
108
|
-
"aria-label": y["aria-label"] ?? (typeof b?.title == "string" ? b.title : w ? `${w} code` : "Code"),
|
|
109
|
-
className: e("bl-syntax-pre bl-scroll", h),
|
|
110
|
-
style: {
|
|
111
|
-
maxHeight: l,
|
|
112
|
-
"--bl-syntax-gutter-digits": String(String(P).length),
|
|
113
|
-
..._
|
|
114
|
-
},
|
|
115
|
-
...y,
|
|
116
|
-
children: /* @__PURE__ */ g("code", {
|
|
117
|
-
className: "bl-syntax-code",
|
|
118
|
-
children: F.length ? F.map(([e, t]) => /* @__PURE__ */ g("span", {
|
|
119
|
-
className: "bl-syntax-chunk",
|
|
120
|
-
style: { containIntrinsicBlockSize: `auto calc(${t - e} * 1lh)` },
|
|
121
|
-
children: /* @__PURE__ */ g(k, {
|
|
122
|
-
lines: O,
|
|
123
|
-
from: e,
|
|
124
|
-
to: t,
|
|
125
|
-
startLine: i,
|
|
126
|
-
lineNumbers: r,
|
|
127
|
-
marks: M,
|
|
128
|
-
lineProps: d
|
|
129
|
-
})
|
|
130
|
-
}, e)) : /* @__PURE__ */ g(k, {
|
|
131
|
-
lines: O,
|
|
132
|
-
from: 0,
|
|
133
|
-
to: O.length,
|
|
134
|
-
startLine: i,
|
|
135
|
-
lineNumbers: r,
|
|
136
|
-
marks: M,
|
|
137
|
-
lineProps: d
|
|
138
|
-
})
|
|
139
|
-
})
|
|
21
|
+
...n
|
|
140
22
|
});
|
|
141
23
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
for (let l = n; l < r; l++) {
|
|
145
|
-
let n = i + l, r = s?.(n);
|
|
146
|
-
c.push(/* @__PURE__ */ _("span", {
|
|
147
|
-
...r,
|
|
148
|
-
className: e("bl-syntax-line", r?.className),
|
|
149
|
-
"data-line": n,
|
|
150
|
-
"data-highlighted": o.hl.has(n) || void 0,
|
|
151
|
-
"data-diff": o.add.has(n) ? "add" : o.del.has(n) ? "del" : void 0,
|
|
152
|
-
children: [a ? /* @__PURE__ */ g("span", {
|
|
153
|
-
className: "bl-syntax-ln",
|
|
154
|
-
"data-n": n,
|
|
155
|
-
"aria-hidden": "true"
|
|
156
|
-
}) : null, /* @__PURE__ */ _("span", {
|
|
157
|
-
className: "bl-syntax-lc",
|
|
158
|
-
children: [/* @__PURE__ */ g(S, { tokens: t[l] }), l < t.length - 1 ? "\n" : null]
|
|
159
|
-
})]
|
|
160
|
-
}, l));
|
|
161
|
-
}
|
|
162
|
-
return /* @__PURE__ */ g(h, { children: c });
|
|
163
|
-
});
|
|
164
|
-
function A({ className: t, ...n }) {
|
|
165
|
-
return /* @__PURE__ */ g("div", {
|
|
24
|
+
function f(e) {
|
|
25
|
+
return /* @__PURE__ */ c(r, {
|
|
166
26
|
"data-slot": "syntax-highlighting-header",
|
|
167
|
-
|
|
168
|
-
...n
|
|
27
|
+
...e
|
|
169
28
|
});
|
|
170
29
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
173
|
-
return /* @__PURE__ */ g("span", {
|
|
30
|
+
function p(e) {
|
|
31
|
+
return /* @__PURE__ */ c(i, {
|
|
174
32
|
"data-slot": "syntax-highlighting-title",
|
|
175
|
-
|
|
176
|
-
...r,
|
|
177
|
-
children: n ?? i?.title
|
|
33
|
+
...e
|
|
178
34
|
});
|
|
179
35
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return await navigator.clipboard.writeText(e), !0;
|
|
183
|
-
} catch {
|
|
184
|
-
let t = document.createElement("textarea");
|
|
185
|
-
t.value = e, t.setAttribute("readonly", ""), t.style.cssText = "position:fixed;opacity:0;pointer-events:none", document.body.appendChild(t), t.select();
|
|
186
|
-
let n = document.execCommand("copy");
|
|
187
|
-
return t.remove(), n;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function N({ value: t, label: n = "Copy code", onCopy: r, className: i, children: a, ...o }) {
|
|
191
|
-
let s = u(T), [c, l] = m(!1), f = p(void 0);
|
|
192
|
-
d(() => () => clearTimeout(f.current), []);
|
|
193
|
-
let b = t ?? s?.code ?? "";
|
|
194
|
-
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(v, {
|
|
36
|
+
function m(e) {
|
|
37
|
+
return /* @__PURE__ */ c(n, {
|
|
195
38
|
"data-slot": "syntax-highlighting-copy",
|
|
196
|
-
|
|
197
|
-
"aria-label": c ? "Copied" : n,
|
|
198
|
-
...o,
|
|
199
|
-
className: y(i, (t) => e("bl-syntax-copy", t)),
|
|
200
|
-
onPress: async (e) => {
|
|
201
|
-
o.onPress?.(e), await M(b) && (r?.(b), l(!0), clearTimeout(f.current), f.current = setTimeout(() => l(!1), 1600));
|
|
202
|
-
},
|
|
203
|
-
children: a ?? /* @__PURE__ */ g("svg", {
|
|
204
|
-
viewBox: "0 0 16 16",
|
|
205
|
-
width: "14",
|
|
206
|
-
height: "14",
|
|
207
|
-
fill: "none",
|
|
208
|
-
stroke: "currentColor",
|
|
209
|
-
strokeWidth: "1.5",
|
|
210
|
-
strokeLinecap: "round",
|
|
211
|
-
strokeLinejoin: "round",
|
|
212
|
-
"aria-hidden": "true",
|
|
213
|
-
children: c ? /* @__PURE__ */ g("path", { d: "m3 8.5 3.2 3.2L13 4.8" }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("rect", {
|
|
214
|
-
x: "5.2",
|
|
215
|
-
y: "5.2",
|
|
216
|
-
width: "8.6",
|
|
217
|
-
height: "8.6",
|
|
218
|
-
rx: "1.6"
|
|
219
|
-
}), /* @__PURE__ */ g("path", { d: "M10.8 5.2V3.6c0-1-.8-1.8-1.8-1.8H3.6c-1 0-1.8.8-1.8 1.8V9c0 1 .8 1.8 1.8 1.8h1.6" })] })
|
|
220
|
-
})
|
|
221
|
-
}), /* @__PURE__ */ g("span", {
|
|
222
|
-
role: "status",
|
|
223
|
-
className: "bl-syntax-sr",
|
|
224
|
-
children: c ? "Copied to clipboard" : ""
|
|
225
|
-
})] });
|
|
226
|
-
}
|
|
227
|
-
function P({ code: n, language: r, title: i, showCopy: a = !1, variant: o, appearance: s, className: c, contentClassName: l, style: u, children: d, lineNumbers: p, startLine: m, highlightLines: v, addedLines: y, removedLines: b, wrap: x, maxHeight: S, lineProps: C, highlight: E, engine: D, ...k }) {
|
|
228
|
-
let M = t(), P = s ?? M, I = o ?? "default", L = f(() => ({
|
|
229
|
-
code: n,
|
|
230
|
-
language: r,
|
|
231
|
-
variant: I,
|
|
232
|
-
title: i,
|
|
233
|
-
engine: D
|
|
234
|
-
}), [
|
|
235
|
-
n,
|
|
236
|
-
r,
|
|
237
|
-
I,
|
|
238
|
-
i,
|
|
239
|
-
D
|
|
240
|
-
]);
|
|
241
|
-
return I === "inline" ? /* @__PURE__ */ g(F, {
|
|
242
|
-
code: n,
|
|
243
|
-
language: r,
|
|
244
|
-
scheme: P,
|
|
245
|
-
className: c,
|
|
246
|
-
style: u,
|
|
247
|
-
highlight: E,
|
|
248
|
-
engine: D,
|
|
249
|
-
...k
|
|
250
|
-
}) : /* @__PURE__ */ g(T.Provider, {
|
|
251
|
-
value: L,
|
|
252
|
-
children: /* @__PURE__ */ g("div", {
|
|
253
|
-
"data-slot": "syntax-highlighting",
|
|
254
|
-
"data-variant": I,
|
|
255
|
-
"data-language": r,
|
|
256
|
-
className: e(w({ variant: I }), P === "dark" ? "scheme-dark" : P === "light" ? "scheme-light" : null, c),
|
|
257
|
-
style: u,
|
|
258
|
-
...k,
|
|
259
|
-
children: d ?? /* @__PURE__ */ _(h, { children: [i == null ? a ? /* @__PURE__ */ g(N, { className: "bl-syntax-copy-float" }) : null : /* @__PURE__ */ _(A, { children: [/* @__PURE__ */ g(j, {}), a ? /* @__PURE__ */ g(N, {}) : null] }), /* @__PURE__ */ g(O, {
|
|
260
|
-
className: l,
|
|
261
|
-
lineNumbers: p,
|
|
262
|
-
startLine: m,
|
|
263
|
-
highlightLines: v,
|
|
264
|
-
addedLines: y,
|
|
265
|
-
removedLines: b,
|
|
266
|
-
wrap: x,
|
|
267
|
-
maxHeight: S,
|
|
268
|
-
lineProps: C,
|
|
269
|
-
highlight: E,
|
|
270
|
-
engine: D
|
|
271
|
-
})] })
|
|
272
|
-
})
|
|
39
|
+
...e
|
|
273
40
|
});
|
|
274
41
|
}
|
|
275
|
-
function
|
|
276
|
-
let
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
return /* @__PURE__ */
|
|
42
|
+
function h({ code: t, ...n }) {
|
|
43
|
+
let r = {
|
|
44
|
+
readOnly: !0,
|
|
45
|
+
value: t,
|
|
46
|
+
...n
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ c(e, {
|
|
282
49
|
"data-slot": "syntax-highlighting",
|
|
283
|
-
|
|
284
|
-
"data-language": n,
|
|
285
|
-
"data-highlighter": l,
|
|
286
|
-
"data-engine": o && o !== "auto" ? o : void 0,
|
|
287
|
-
className: e(w({ variant: "inline" }), r === "dark" ? "scheme-dark" : r === "light" ? "scheme-light" : null, i),
|
|
288
|
-
...s,
|
|
289
|
-
children: c.map((e, t) => /* @__PURE__ */ _("span", { children: [t ? "\n" : null, /* @__PURE__ */ g(S, { tokens: e })] }, t))
|
|
50
|
+
...r
|
|
290
51
|
});
|
|
291
52
|
}
|
|
292
53
|
//#endregion
|
|
293
|
-
export {
|
|
54
|
+
export { h as SyntaxHighlighting, d as SyntaxHighlightingContent, m as SyntaxHighlightingCopyButton, f as SyntaxHighlightingHeader, p as SyntaxHighlightingTitle, l as syntaxHighlightingVariants, u as useSyntaxHighlighting };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { HTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { TerminalProps as WTerminalProps } from '@wterm/react';
|
|
4
|
+
import { TerminalCore, WTerm } from '@wterm/dom';
|
|
5
|
+
import { TerminalCommandHandler, TerminalCompleter, TerminalShell } from '../lib/terminal-line';
|
|
6
|
+
export declare const terminalVariants: (props?: ({
|
|
7
|
+
size?: "sm" | "md" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
|
+
export interface TerminalHandle {
|
|
10
|
+
/** Prints to the terminal. With a `prompt`, above it, without disturbing the line being typed. */
|
|
11
|
+
write: (data: string | Uint8Array) => void;
|
|
12
|
+
/** Clears the screen and the scrollback. */
|
|
13
|
+
clear: () => void;
|
|
14
|
+
focus: () => void;
|
|
15
|
+
/** Sets the grid size. A Terminal fills its container, so its next change of size refits it. */
|
|
16
|
+
resize: (cols: number, rows: number) => void;
|
|
17
|
+
/** Fits the grid to the container now. */
|
|
18
|
+
fit: () => void;
|
|
19
|
+
readonly cols: number;
|
|
20
|
+
readonly rows: number;
|
|
21
|
+
/** The wterm instance: search, selection, `readText()`… */
|
|
22
|
+
readonly instance: WTerm | null;
|
|
23
|
+
/** The shell behind `prompt` / `onCommand` or the `shell` prop. */
|
|
24
|
+
readonly shell: TerminalShell | null;
|
|
25
|
+
}
|
|
26
|
+
type WTermEvents = Pick<WTerminalProps, 'onBinary' | 'onBell' | 'onClipboardWrite' | 'onShellIntegration' | 'onTitle' | 'onWorkingDirectory' | 'onError' | 'onResize'>;
|
|
27
|
+
type WTermOptions = Pick<WTerminalProps, 'cursorBlink' | 'announceOutput' | 'renderingPaused' | 'webmcp'>;
|
|
28
|
+
export interface TerminalProps extends Omit<HTMLAttributes<HTMLDivElement>, keyof WTermEvents | 'children' | 'onInput'>, WTermEvents, WTermOptions, VariantProps<typeof terminalVariants> {
|
|
29
|
+
ref?: Ref<TerminalHandle>;
|
|
30
|
+
/** The terminal core. `ghostty` (default) loads a 600 KB WebAssembly file from your site on first use and re-wraps text
|
|
31
|
+
* when the terminal resizes, falling back to `builtin` if it can't be loaded. `builtin` needs no file, but narrowing a
|
|
32
|
+
* terminal cuts off what's on screen for good. Or pass a core of your own, which stays yours to dispose of. */
|
|
33
|
+
core?: 'ghostty' | 'builtin' | TerminalCore;
|
|
34
|
+
/** Everything the terminal sends: keys, and replies to programs' queries. With neither this nor a shell, input is
|
|
35
|
+
* echoed back, which is wterm's default. */
|
|
36
|
+
onData?: (data: string) => void;
|
|
37
|
+
/** Runs each line typed at the prompt. Turns on line editing, history and Ctrl-C (see `lib/terminal-line`); read once
|
|
38
|
+
* when the terminal mounts, like the rest of the shell props, except that the latest callback always runs. */
|
|
39
|
+
onCommand?: TerminalCommandHandler;
|
|
40
|
+
/** The prompt, one row. May carry colors. Default `$ `. */
|
|
41
|
+
prompt?: string | (() => string);
|
|
42
|
+
/** Tab: candidates for the word at the cursor. */
|
|
43
|
+
complete?: TerminalCompleter;
|
|
44
|
+
/** Ctrl-D on an empty line. */
|
|
45
|
+
onEof?: () => void;
|
|
46
|
+
/** Lines the up arrow starts with, oldest first. */
|
|
47
|
+
history?: readonly string[];
|
|
48
|
+
/** Printed before the first prompt. */
|
|
49
|
+
greeting?: string;
|
|
50
|
+
/** A shell you keep yourself (`createTerminalShell`). Output, the typed line and a running command outlive this
|
|
51
|
+
* component: a new Terminal given the same shell picks up where it left off. */
|
|
52
|
+
shell?: TerminalShell;
|
|
53
|
+
/** Output only: what's typed goes nowhere. */
|
|
54
|
+
readOnly?: boolean;
|
|
55
|
+
/** Take the keyboard when ready. wterm always does; without this, focus goes back where it was. */
|
|
56
|
+
autoFocus?: boolean;
|
|
57
|
+
/** The terminal is up: `instance.write(…)` works, and the grid fits the container. */
|
|
58
|
+
onReady?: (instance: WTerm) => void;
|
|
59
|
+
}
|
|
60
|
+
export declare function Terminal({ ref, className, style, size, core: coreProp, onData, onCommand, prompt, complete, onEof, history, greeting, shell: shellProp, readOnly, autoFocus, onReady, onResize, onFocusCapture, ...props }: TerminalProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=terminal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/components/terminal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqE,KAAK,cAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACzH,OAAO,EAAO,KAAK,YAAY,E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