@industry-theme/file-city-panel 0.5.53 → 0.5.54
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/ContextContainer.d.ts +40 -0
- package/dist/components/ContextContainer.d.ts.map +1 -0
- package/dist/components/TourPlayer.d.ts +49 -0
- package/dist/components/TourPlayer.d.ts.map +1 -0
- package/dist/components/TourPlayerIntegration.d.ts +26 -0
- package/dist/components/TourPlayerIntegration.d.ts.map +1 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useFuzzyFileSearch.d.ts +24 -0
- package/dist/hooks/useFuzzyFileSearch.d.ts.map +1 -0
- package/dist/hooks/useTourPlayer.d.ts +55 -0
- package/dist/hooks/useTourPlayer.d.ts.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/mocks/MockTTSAdapter.d.ts +85 -0
- package/dist/mocks/MockTTSAdapter.d.ts.map +1 -0
- package/dist/mocks/mockAudioActions.d.ts +27 -0
- package/dist/mocks/mockAudioActions.d.ts.map +1 -0
- package/dist/mocks/panelContext.d.ts +36 -0
- package/dist/mocks/panelContext.d.ts.map +1 -0
- package/dist/panels/CodeCityPanel.d.ts +108 -0
- package/dist/panels/CodeCityPanel.d.ts.map +1 -0
- package/dist/panels/FeedCodeCityPanel.d.ts +19 -0
- package/dist/panels/FeedCodeCityPanel.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/AddToAreaModal.d.ts +14 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/AddToAreaModal.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/AddToScopeModal.d.ts +14 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/AddToScopeModal.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/CommitFileOverlay.d.ts +18 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/CommitFileOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/FileCityExplorer.d.ts +87 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/FileCityExplorer.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/RecentCommitCard.d.ts +37 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/RecentCommitCard.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/ScopeInfoOverlay.d.ts +10 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/ScopeInfoOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/WorkingTreeCard.d.ts +32 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/WorkingTreeCard.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/WorkingTreeFileOverlay.d.ts +21 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/WorkingTreeFileOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/index.d.ts +2 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/index.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/layers.d.ts +22 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/layers.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/pathConversion.d.ts +19 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/pathConversion.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/scopeTreePaths.d.ts +21 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/scopeTreePaths.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/styles.d.ts +9 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorer/styles.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorerPanel.d.ts +4 -0
- package/dist/panels/FileCityExplorerPanel/FileCityExplorerPanel.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/buildCityDataFromContext.d.ts +34 -0
- package/dist/panels/FileCityExplorerPanel/buildCityDataFromContext.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/index.d.ts +4 -0
- package/dist/panels/FileCityExplorerPanel/index.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/FileOverlay.d.ts +11 -0
- package/dist/panels/FileCityExplorerPanel/overlays/FileOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/MarkdownNotes.d.ts +58 -0
- package/dist/panels/FileCityExplorerPanel/overlays/MarkdownNotes.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/PierreFileView.d.ts +11 -0
- package/dist/panels/FileCityExplorerPanel/overlays/PierreFileView.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/PierreSnippetDiffView.d.ts +28 -0
- package/dist/panels/FileCityExplorerPanel/overlays/PierreSnippetDiffView.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/PierreSnippetView.d.ts +42 -0
- package/dist/panels/FileCityExplorerPanel/overlays/PierreSnippetView.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceDiagramOverlay.d.ts +15 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceDiagramOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceEventDetailOverlay.d.ts +22 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceEventDetailOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceFilesOverlay.d.ts +28 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceFilesOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceLeaderLine.d.ts +42 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceLeaderLine.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceMarkdownOverlay.d.ts +44 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SequenceMarkdownOverlay.d.ts.map +1 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SnippetNotes.d.ts +67 -0
- package/dist/panels/FileCityExplorerPanel/overlays/SnippetNotes.d.ts.map +1 -0
- package/dist/panels/components/ActivityHeatmapView.d.ts +25 -0
- package/dist/panels/components/ActivityHeatmapView.d.ts.map +1 -0
- package/dist/panels/components/AgentActivityView.d.ts +29 -0
- package/dist/panels/components/AgentActivityView.d.ts.map +1 -0
- package/dist/panels/components/BuildingCityLoader.d.ts +11 -0
- package/dist/panels/components/BuildingCityLoader.d.ts.map +1 -0
- package/dist/panels/components/CommitChangesTree.d.ts +29 -0
- package/dist/panels/components/CommitChangesTree.d.ts.map +1 -0
- package/dist/panels/components/CoverEditor.d.ts +22 -0
- package/dist/panels/components/CoverEditor.d.ts.map +1 -0
- package/dist/panels/components/EmptyState.d.ts +12 -0
- package/dist/panels/components/EmptyState.d.ts.map +1 -0
- package/dist/panels/components/FeedProjectHeader.d.ts +86 -0
- package/dist/panels/components/FeedProjectHeader.d.ts.map +1 -0
- package/dist/panels/components/FileCardList.d.ts +44 -0
- package/dist/panels/components/FileCardList.d.ts.map +1 -0
- package/dist/panels/components/FileCityTips.d.ts +7 -0
- package/dist/panels/components/FileCityTips.d.ts.map +1 -0
- package/dist/panels/components/FileTypesView.d.ts +23 -0
- package/dist/panels/components/FileTypesView.d.ts.map +1 -0
- package/dist/panels/components/GitChangesCardList.d.ts +29 -0
- package/dist/panels/components/GitChangesCardList.d.ts.map +1 -0
- package/dist/panels/components/GitChangesTree.d.ts +26 -0
- package/dist/panels/components/GitChangesTree.d.ts.map +1 -0
- package/dist/panels/components/GitChangesView.d.ts +27 -0
- package/dist/panels/components/GitChangesView.d.ts.map +1 -0
- package/dist/panels/components/HoverInfoBar.d.ts +29 -0
- package/dist/panels/components/HoverInfoBar.d.ts.map +1 -0
- package/dist/panels/components/Legend.d.ts +145 -0
- package/dist/panels/components/Legend.d.ts.map +1 -0
- package/dist/panels/components/LegendTabs.d.ts +35 -0
- package/dist/panels/components/LegendTabs.d.ts.map +1 -0
- package/dist/panels/components/PackageInfo.d.ts +26 -0
- package/dist/panels/components/PackageInfo.d.ts.map +1 -0
- package/dist/panels/components/PackageManagerIcon.d.ts +10 -0
- package/dist/panels/components/PackageManagerIcon.d.ts.map +1 -0
- package/dist/panels/components/PrChangesCardList.d.ts +38 -0
- package/dist/panels/components/PrChangesCardList.d.ts.map +1 -0
- package/dist/panels/components/PrChangesTree.d.ts +32 -0
- package/dist/panels/components/PrChangesTree.d.ts.map +1 -0
- package/dist/panels/components/ProjectHeader.d.ts +36 -0
- package/dist/panels/components/ProjectHeader.d.ts.map +1 -0
- package/dist/panels/components/ProjectInfoHeader.d.ts +47 -0
- package/dist/panels/components/ProjectInfoHeader.d.ts.map +1 -0
- package/dist/panels/components/ProjectInfoView.d.ts +17 -0
- package/dist/panels/components/ProjectInfoView.d.ts.map +1 -0
- package/dist/panels/components/QualityMetricsView.d.ts +22 -0
- package/dist/panels/components/QualityMetricsView.d.ts.map +1 -0
- package/dist/panels/components/ScopesCanvasView.d.ts +17 -0
- package/dist/panels/components/ScopesCanvasView.d.ts.map +1 -0
- package/dist/panels/components/SearchResultsView.d.ts +19 -0
- package/dist/panels/components/SearchResultsView.d.ts.map +1 -0
- package/dist/panels/components/StoryboardFilesCardList.d.ts +28 -0
- package/dist/panels/components/StoryboardFilesCardList.d.ts.map +1 -0
- package/dist/panels/components/StoryboardFilesTree.d.ts +26 -0
- package/dist/panels/components/StoryboardFilesTree.d.ts.map +1 -0
- package/dist/panels/components/StoryboardView.d.ts +38 -0
- package/dist/panels/components/StoryboardView.d.ts.map +1 -0
- package/dist/panels/index.d.ts +4 -0
- package/dist/panels/index.d.ts.map +1 -0
- package/dist/panels/stress-test-data.d.ts +40 -0
- package/dist/panels/stress-test-data.d.ts.map +1 -0
- package/dist/panels/utils/cityData.d.ts +5 -0
- package/dist/panels/utils/cityData.d.ts.map +1 -0
- package/dist/panels/utils/qualityLayers.d.ts +119 -0
- package/dist/panels/utils/qualityLayers.d.ts.map +1 -0
- package/dist/tools/index.d.ts +32 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools.bundle.js +103 -0
- package/dist/types/FileCityExplorerPanel.d.ts +132 -0
- package/dist/types/FileCityExplorerPanel.d.ts.map +1 -0
- package/dist/types/Scope.d.ts +94 -0
- package/dist/types/Scope.d.ts.map +1 -0
- package/dist/types/SequenceDiagram.d.ts +306 -0
- package/dist/types/SequenceDiagram.d.ts.map +1 -0
- package/dist/types/TextToSpeech.d.ts +118 -0
- package/dist/types/TextToSpeech.d.ts.map +1 -0
- package/dist/types/TourExtensions.d.ts +28 -0
- package/dist/types/TourExtensions.d.ts.map +1 -0
- package/dist/types/index.d.ts +204 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope / namespace / event records.
|
|
3
|
+
*
|
|
4
|
+
* In-memory model that mirrors the on-disk `.scopes.canvas` schema closely
|
|
5
|
+
* but flattens it into a tree the UI can navigate without touching JSON
|
|
6
|
+
* Canvas positioning details for reads.
|
|
7
|
+
*
|
|
8
|
+
* This package owns the type. electron-app's
|
|
9
|
+
* `services/scope-manager/types.ts` should swap to importing from here in
|
|
10
|
+
* the same migration as SequenceDiagram. See
|
|
11
|
+
* `docs/FILE_CITY_EXPLORER_PORT.md`.
|
|
12
|
+
*
|
|
13
|
+
* `ProjectArea` and `AuxiliaryManifest` are NOT defined here — those live
|
|
14
|
+
* upstream in `@principal-ai/principal-view-core` (>=0.27.0).
|
|
15
|
+
*/
|
|
16
|
+
export interface NodePosition {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}
|
|
22
|
+
export interface EventAttributeSchema {
|
|
23
|
+
type: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
description?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface EventRecord {
|
|
28
|
+
name: string;
|
|
29
|
+
severity?: 'INFO' | 'WARN' | 'ERROR';
|
|
30
|
+
description?: string;
|
|
31
|
+
attributes?: Record<string, EventAttributeSchema>;
|
|
32
|
+
}
|
|
33
|
+
export interface NamespaceRecord {
|
|
34
|
+
/** Namespace key (e.g. `"filetree"`). Unique within a scope. */
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
paths: string[];
|
|
38
|
+
events: EventRecord[];
|
|
39
|
+
/** Preserved canvas position so round-trips don't reflow the diagram. */
|
|
40
|
+
position?: NodePosition;
|
|
41
|
+
/** Hex color attached to the canvas node, if any. */
|
|
42
|
+
color?: string;
|
|
43
|
+
/** Stable canvas node id, preserved across writes. */
|
|
44
|
+
nodeId?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ScopeRecord {
|
|
47
|
+
/** Dotted scope name (e.g. `"principal-view.cli"`). Identity. */
|
|
48
|
+
name: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
paths: string[];
|
|
51
|
+
/** Hex color from the `.scopes.canvas` node, if any. */
|
|
52
|
+
color?: string;
|
|
53
|
+
/** OTEL status from the `.scopes.canvas` node (`"draft"`, `"ready"`, etc.). */
|
|
54
|
+
status?: string;
|
|
55
|
+
/** Optional human-readable label override (defaults to `name`). */
|
|
56
|
+
label?: string;
|
|
57
|
+
namespaces: NamespaceRecord[];
|
|
58
|
+
/** Preserved canvas position for the otel-scope node. */
|
|
59
|
+
position?: NodePosition;
|
|
60
|
+
/** Stable canvas node id, preserved across writes. */
|
|
61
|
+
nodeId?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ScopeWorkspace {
|
|
64
|
+
scopes: ScopeRecord[];
|
|
65
|
+
}
|
|
66
|
+
export interface AddScopeInput {
|
|
67
|
+
name: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
paths?: string[];
|
|
70
|
+
color?: string;
|
|
71
|
+
status?: string;
|
|
72
|
+
label?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface AddNamespaceInput {
|
|
75
|
+
scopeName: string;
|
|
76
|
+
name: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
paths?: string[];
|
|
79
|
+
color?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface AddPathToNamespaceInput {
|
|
82
|
+
scopeName: string;
|
|
83
|
+
namespaceName: string;
|
|
84
|
+
path: string;
|
|
85
|
+
}
|
|
86
|
+
export interface AddEventInput {
|
|
87
|
+
scopeName: string;
|
|
88
|
+
namespaceName: string;
|
|
89
|
+
name: string;
|
|
90
|
+
severity?: 'INFO' | 'WARN' | 'ERROR';
|
|
91
|
+
description?: string;
|
|
92
|
+
attributes?: Record<string, EventAttributeSchema>;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=Scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scope.d.ts","sourceRoot":"","sources":["../../src/types/Scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EA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AM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACnD"}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified sequence-diagram types.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for both `electron-app` and `web-ade`. Both
|
|
5
|
+
* historically maintained their own duplicated copies (electron's
|
|
6
|
+
* `FileCitySequenceAPI.ts`, web-ade's `lib/sequence-diagrams/types.ts`);
|
|
7
|
+
* this file replaces both. See `docs/FILE_CITY_EXPLORER_PORT.md` for the
|
|
8
|
+
* drift reconciliation that produced these shapes.
|
|
9
|
+
*
|
|
10
|
+
* Hardening choices (deviations from either historical copy):
|
|
11
|
+
* - `id`, `title`, `createdAt`, `updatedAt` are required on
|
|
12
|
+
* `SequenceDiagramPayload`. Producers generate ids and timestamps;
|
|
13
|
+
* storage layers reject payloads missing them.
|
|
14
|
+
* - `startLine` / `endLine` are required on `DiffSnippet` (matching
|
|
15
|
+
* `SliceSnippet`).
|
|
16
|
+
* - `author` is required on notes; hosts identify the author at write
|
|
17
|
+
* time (e.g. session user, agent name, or a system label).
|
|
18
|
+
* - `BaseSequenceDiagramIndexEntry.title` and `summaryPreview` are
|
|
19
|
+
* required (empty string when there is no summary). UIs drop their
|
|
20
|
+
* "missing" fallbacks; hosts derive defaults at index time.
|
|
21
|
+
*/
|
|
22
|
+
import type { SequenceEvent, SequenceEdge } from '@principal-ai/principal-view-react';
|
|
23
|
+
export type { SequenceEvent, SequenceEdge };
|
|
24
|
+
/**
|
|
25
|
+
* Slice snippet — single-file window over `event.sourcePath`.
|
|
26
|
+
*
|
|
27
|
+
* `kind` is optional for back-compat with producers that pre-date the
|
|
28
|
+
* discriminated union. Missing `kind` is treated as `'slice'`. New
|
|
29
|
+
* producers should always set it.
|
|
30
|
+
*/
|
|
31
|
+
export interface SliceSnippet {
|
|
32
|
+
kind?: 'slice';
|
|
33
|
+
/** First line of the snippet (1-based, inclusive). */
|
|
34
|
+
startLine: number;
|
|
35
|
+
/** Last line of the snippet (1-based, inclusive). */
|
|
36
|
+
endLine: number;
|
|
37
|
+
/** Line to highlight as the focus point; defaults to `startLine`. */
|
|
38
|
+
focusLine?: number;
|
|
39
|
+
/** Lines of context above/below the snippet; defaults to 2. */
|
|
40
|
+
contextLines?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Diff snippet — before/after view inline. Used by code-review walkthroughs
|
|
44
|
+
* where each event represents a change region in a PR.
|
|
45
|
+
*/
|
|
46
|
+
export interface DiffSnippet {
|
|
47
|
+
kind: 'diff';
|
|
48
|
+
/** Pre-change file contents (full file or a pre-sliced window). */
|
|
49
|
+
oldContents: string;
|
|
50
|
+
/**
|
|
51
|
+
* Post-change file contents. When omitted, the renderer reads the current
|
|
52
|
+
* contents at `event.sourcePath` and diffs against `oldContents`.
|
|
53
|
+
*/
|
|
54
|
+
newContents?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Snippet window (1-based, inclusive) applied to both sides before
|
|
57
|
+
* diffing. Producers must set this — derive from contents length when
|
|
58
|
+
* the snippet covers the whole file.
|
|
59
|
+
*/
|
|
60
|
+
startLine: number;
|
|
61
|
+
/** 1-based, inclusive. */
|
|
62
|
+
endLine: number;
|
|
63
|
+
/** Line in the post-change window to call out (1-based). */
|
|
64
|
+
focusLine?: number;
|
|
65
|
+
/** Lines of unchanged context kept around the window; defaults to 2. */
|
|
66
|
+
contextLines?: number;
|
|
67
|
+
/** Pierre rendering style. Defaults to `'unified'`. */
|
|
68
|
+
diffStyle?: 'unified' | 'split';
|
|
69
|
+
/** Syntax-highlighting hint (e.g. `'typescript'`, `'python'`). */
|
|
70
|
+
language?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Opt-in hydration from GitHub at view time. No producer sets this today;
|
|
73
|
+
* declared so the schema is forward-compatible.
|
|
74
|
+
*/
|
|
75
|
+
gitRef?: {
|
|
76
|
+
sha: string;
|
|
77
|
+
path: string;
|
|
78
|
+
branch?: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export type SequenceEventSnippet = SliceSnippet | DiffSnippet;
|
|
82
|
+
/**
|
|
83
|
+
* Sequence event used by File City. Adds an optional snippet reference and
|
|
84
|
+
* human-readable description on top of the upstream `SequenceEvent` shape.
|
|
85
|
+
*/
|
|
86
|
+
export type FileCitySequenceEventDef = SequenceEvent & {
|
|
87
|
+
snippet?: SequenceEventSnippet;
|
|
88
|
+
/**
|
|
89
|
+
* Human-readable description of the change/event. Surfaced in the
|
|
90
|
+
* left-edge explainer overlay when the event is selected — useful for
|
|
91
|
+
* code-review walkthroughs where each event needs a "why" alongside the
|
|
92
|
+
* snippet.
|
|
93
|
+
*/
|
|
94
|
+
description?: string;
|
|
95
|
+
};
|
|
96
|
+
export interface SequenceLayoutOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Resolved namespaces in left-to-right order. Listed lanes are placed
|
|
99
|
+
* first; any unlisted lanes (including ones that materialize after a
|
|
100
|
+
* drill-down) fall back to first-event order behind them. Unknown
|
|
101
|
+
* entries are ignored, so callers can safely list namespaces that may
|
|
102
|
+
* not be present in every dataset.
|
|
103
|
+
*
|
|
104
|
+
* Without this option, lane order follows the order events first appear
|
|
105
|
+
* in `payload.events`.
|
|
106
|
+
*/
|
|
107
|
+
laneOrder?: string[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One disjoint line range covered by a slice anchor. Notes can cover
|
|
111
|
+
* multiple ranges (e.g. a comment that spans two related code blocks);
|
|
112
|
+
* each range carries its own re-anchor fingerprints so the note can be
|
|
113
|
+
* re-located even if intervening lines move.
|
|
114
|
+
*/
|
|
115
|
+
export interface SliceRange {
|
|
116
|
+
/** 1-based absolute line in the source file (inclusive). */
|
|
117
|
+
startLine: number;
|
|
118
|
+
/** 1-based absolute line (inclusive). For single-line ranges, equals `startLine`. */
|
|
119
|
+
endLine: number;
|
|
120
|
+
/** `startLine`'s text at creation time — re-anchor fingerprint. */
|
|
121
|
+
startLineText: string;
|
|
122
|
+
/** `endLine`'s text at creation time. Equals `startLineText` for single-line ranges. */
|
|
123
|
+
endLineText: string;
|
|
124
|
+
}
|
|
125
|
+
export interface SnippetSliceAnchor {
|
|
126
|
+
kind: 'slice';
|
|
127
|
+
/**
|
|
128
|
+
* One or more disjoint ranges this note covers. Multi-range notes show
|
|
129
|
+
* one indicator pill per range start; the side panel renders one
|
|
130
|
+
* thread.
|
|
131
|
+
*/
|
|
132
|
+
ranges: SliceRange[];
|
|
133
|
+
}
|
|
134
|
+
export interface SnippetDiffAnchor {
|
|
135
|
+
kind: 'diff';
|
|
136
|
+
side: 'deletions' | 'additions';
|
|
137
|
+
lineNumber: number;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Note attached to a snippet line. Lives on `payload.notes` so persistence
|
|
141
|
+
* and broadcast piggyback on the existing payload path. Only the renderer
|
|
142
|
+
* or host can mutate notes — external HTTP POSTs of payloads must strip
|
|
143
|
+
* this field during validation.
|
|
144
|
+
*/
|
|
145
|
+
export interface SequenceSnippetNote {
|
|
146
|
+
id: string;
|
|
147
|
+
kind: 'snippet';
|
|
148
|
+
scope: {
|
|
149
|
+
eventId: string;
|
|
150
|
+
};
|
|
151
|
+
anchor: SnippetSliceAnchor | SnippetDiffAnchor;
|
|
152
|
+
body: string;
|
|
153
|
+
/**
|
|
154
|
+
* Required. Hosts identify the author at write time — current user,
|
|
155
|
+
* agent name, or a system label like `'anonymous'`. Display code drops
|
|
156
|
+
* its `if (note.author)` guard.
|
|
157
|
+
*/
|
|
158
|
+
author: string;
|
|
159
|
+
/** ISO 8601. */
|
|
160
|
+
createdAt: string;
|
|
161
|
+
/** ISO 8601 — equal to `createdAt` until first edit. */
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Markdown notes anchor to a quoted span using the W3C text-quote
|
|
166
|
+
* selector (matches themed-markdown's `Annotation.anchor` shape).
|
|
167
|
+
*/
|
|
168
|
+
export interface MarkdownTextQuoteAnchor {
|
|
169
|
+
kind: 'text-quote';
|
|
170
|
+
exact: string;
|
|
171
|
+
prefix?: string;
|
|
172
|
+
suffix?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Where in the markdown overlay the note is anchored. The overlay swaps
|
|
176
|
+
* between an event's `description` and the payload's `summary`, so we tag
|
|
177
|
+
* which surface the note belongs to.
|
|
178
|
+
*/
|
|
179
|
+
export type MarkdownNoteScope = {
|
|
180
|
+
kind: 'description';
|
|
181
|
+
eventId: string;
|
|
182
|
+
} | {
|
|
183
|
+
kind: 'summary';
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Note attached to a markdown selection in the left-edge sequence-diagram
|
|
187
|
+
* overlay. Same persistence story as `SequenceSnippetNote` — lives on
|
|
188
|
+
* `payload.notes`, mutated only via host actions, stripped from external
|
|
189
|
+
* HTTP payloads during validation.
|
|
190
|
+
*/
|
|
191
|
+
export interface SequenceMarkdownNote {
|
|
192
|
+
id: string;
|
|
193
|
+
kind: 'markdown';
|
|
194
|
+
scope: MarkdownNoteScope;
|
|
195
|
+
anchor: MarkdownTextQuoteAnchor;
|
|
196
|
+
body: string;
|
|
197
|
+
/** Required — see hardening note on `SequenceSnippetNote.author`. */
|
|
198
|
+
author: string;
|
|
199
|
+
createdAt: string;
|
|
200
|
+
updatedAt: string;
|
|
201
|
+
}
|
|
202
|
+
/** Discriminated union of all note variants. */
|
|
203
|
+
export type SequenceNote = SequenceSnippetNote | SequenceMarkdownNote;
|
|
204
|
+
/**
|
|
205
|
+
* Payload accepted by note-creation endpoints. Server fills `id`,
|
|
206
|
+
* `createdAt`, `updatedAt`. Discriminated on `kind` so handlers can
|
|
207
|
+
* narrow without conditional fields.
|
|
208
|
+
*/
|
|
209
|
+
export type SequenceNoteDraft = Omit<SequenceSnippetNote, 'id' | 'createdAt' | 'updatedAt'> | Omit<SequenceMarkdownNote, 'id' | 'createdAt' | 'updatedAt'>;
|
|
210
|
+
/**
|
|
211
|
+
* Unified sequence-diagram payload.
|
|
212
|
+
*
|
|
213
|
+
* Producers build it with `id`/timestamps already set; storage layers
|
|
214
|
+
* reject payloads missing required fields. The `repositoryPath` field is
|
|
215
|
+
* only meaningful on the producer side (electron filters open File City
|
|
216
|
+
* panels by it) — web hosts can leave it unset.
|
|
217
|
+
*/
|
|
218
|
+
export interface SequenceDiagramPayload {
|
|
219
|
+
/**
|
|
220
|
+
* Stable id. Producers generate it (e.g. `crypto.randomUUID()`);
|
|
221
|
+
* storage layers reject payloads missing it.
|
|
222
|
+
*/
|
|
223
|
+
id: string;
|
|
224
|
+
/**
|
|
225
|
+
* Title shown in the drawer header. Hosts derive a default
|
|
226
|
+
* (e.g. first event name or `"Untitled flow"`) at construction time.
|
|
227
|
+
*/
|
|
228
|
+
title: string;
|
|
229
|
+
/**
|
|
230
|
+
* Free-form categorization. Used by web-ade's share flow to tag
|
|
231
|
+
* payloads (e.g. `'pr-walkthrough'`, `'incident'`). Electron ignores it.
|
|
232
|
+
*/
|
|
233
|
+
kind?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Producer-side filesystem path; renderers filter by this so a payload
|
|
236
|
+
* targets only the matching File City panel when several are open.
|
|
237
|
+
* Web hosts can leave this unset.
|
|
238
|
+
*/
|
|
239
|
+
repositoryPath?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Markdown summary of the whole flow. Surfaced in the left-edge
|
|
242
|
+
* overlay when no event is selected; per-event `description` takes
|
|
243
|
+
* over once the user picks an event.
|
|
244
|
+
*/
|
|
245
|
+
summary?: string;
|
|
246
|
+
/** Events in display order. */
|
|
247
|
+
events: FileCitySequenceEventDef[];
|
|
248
|
+
/** Edges between events. */
|
|
249
|
+
edges?: SequenceEdge[];
|
|
250
|
+
/** Renderer layout knobs (lane ordering, etc.). */
|
|
251
|
+
layoutOptions?: SequenceLayoutOptions;
|
|
252
|
+
/**
|
|
253
|
+
* ISO 8601 — set at payload creation. Storage layers reject payloads
|
|
254
|
+
* missing it.
|
|
255
|
+
*/
|
|
256
|
+
createdAt: string;
|
|
257
|
+
/**
|
|
258
|
+
* ISO 8601 — equals `createdAt` until first edit, then bumped on
|
|
259
|
+
* every persist.
|
|
260
|
+
*/
|
|
261
|
+
updatedAt: string;
|
|
262
|
+
/**
|
|
263
|
+
* User-authored notes anchored to events. Mutated only via host
|
|
264
|
+
* endpoints; external HTTP POSTs must strip this field during
|
|
265
|
+
* validation.
|
|
266
|
+
*/
|
|
267
|
+
notes?: SequenceNote[];
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Manifest entry that summarizes a payload without loading it. Only the
|
|
271
|
+
* fields any picker UI actually needs.
|
|
272
|
+
*
|
|
273
|
+
* Each host extends this with storage-specific fields (filesystem path /
|
|
274
|
+
* S3 ownership / GitHub repo id / etc.) on its own side. Do NOT add
|
|
275
|
+
* storage-coupled fields here — they're host-private by design, and
|
|
276
|
+
* adding them here would re-couple the UI to a particular storage layer.
|
|
277
|
+
*
|
|
278
|
+
* Picker UIs in this package type their props against
|
|
279
|
+
* `BaseSequenceDiagramIndexEntry`; each host's storage layer extends
|
|
280
|
+
* with its own fields and assigns into the base via TypeScript
|
|
281
|
+
* covariance.
|
|
282
|
+
*/
|
|
283
|
+
export interface BaseSequenceDiagramIndexEntry {
|
|
284
|
+
id: string;
|
|
285
|
+
/**
|
|
286
|
+
* Required. Hosts must provide a non-empty string — derive from the
|
|
287
|
+
* payload (e.g. first event name) or fall back to a placeholder like
|
|
288
|
+
* `"Untitled flow"` at index time. Picker UIs no longer carry the
|
|
289
|
+
* fallback.
|
|
290
|
+
*/
|
|
291
|
+
title: string;
|
|
292
|
+
/**
|
|
293
|
+
* Required. First ~200 chars of `payload.summary`, or empty string
|
|
294
|
+
* when the payload has no summary. Empty-but-present means picker UIs
|
|
295
|
+
* can drop their `if (entry.summaryPreview)` guard.
|
|
296
|
+
*/
|
|
297
|
+
summaryPreview: string;
|
|
298
|
+
eventCount: number;
|
|
299
|
+
hasDiffSnippets: boolean;
|
|
300
|
+
/** ISO 8601. */
|
|
301
|
+
createdAt: string;
|
|
302
|
+
/** ISO 8601. */
|
|
303
|
+
updatedAt: string;
|
|
304
|
+
sizeBytes: number;
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=SequenceDiagram.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SequenceDiagram.d.ts","sourceRoot":"","sources":["../../src/types/SequenceDiagram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEtF,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;AAM5C;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;I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|
1
|
+
/**
|
|
2
|
+
* Text-to-Speech Adapter Types
|
|
3
|
+
*
|
|
4
|
+
* These types define the interface for TTS functionality in tour players.
|
|
5
|
+
* The host application provides a TTS adapter implementation that handles
|
|
6
|
+
* audio generation, caching, and playback.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Audio event types
|
|
10
|
+
*/
|
|
11
|
+
export type TTSEvent = 'ended' | 'error' | 'playing' | 'paused' | 'loading';
|
|
12
|
+
/**
|
|
13
|
+
* Current state of the TTS system
|
|
14
|
+
*/
|
|
15
|
+
export interface TTSState {
|
|
16
|
+
/** Whether audio is currently being loaded/generated */
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
/** Whether audio is currently playing */
|
|
19
|
+
isPlaying: boolean;
|
|
20
|
+
/** Whether audio is paused */
|
|
21
|
+
isPaused: boolean;
|
|
22
|
+
/** Current error, if any */
|
|
23
|
+
error: Error | null;
|
|
24
|
+
/** Playback progress (0-100) */
|
|
25
|
+
progress?: number;
|
|
26
|
+
/** Total duration in seconds */
|
|
27
|
+
duration?: number;
|
|
28
|
+
/** Current playback time in seconds */
|
|
29
|
+
currentTime?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options for TTS generation and playback
|
|
33
|
+
*/
|
|
34
|
+
export interface TTSOptions {
|
|
35
|
+
/** Voice identifier (e.g., ElevenLabs voice ID) */
|
|
36
|
+
voice?: string;
|
|
37
|
+
/** Speech speed multiplier (0.5 - 2.0) */
|
|
38
|
+
speed?: number;
|
|
39
|
+
/** Pitch adjustment (if supported by TTS provider) */
|
|
40
|
+
pitch?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Context information for fetching tour audio
|
|
44
|
+
* This is used to identify the tour file in version control
|
|
45
|
+
*/
|
|
46
|
+
export interface TourAudioContext {
|
|
47
|
+
/** Repository owner (e.g., "anthropics") */
|
|
48
|
+
owner: string;
|
|
49
|
+
/** Repository name (e.g., "web-ade") */
|
|
50
|
+
repo: string;
|
|
51
|
+
/** Path to tour file in repo (e.g., "docs/tours/intro.tour.json") */
|
|
52
|
+
path: string;
|
|
53
|
+
/** Git commit SHA to ensure cache invalidation on changes (optional for cacheOnly mode) */
|
|
54
|
+
commitSha?: string;
|
|
55
|
+
/** When true, only fetch cached audio - don't trigger generation */
|
|
56
|
+
cacheOnly?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Text-to-Speech Adapter Interface
|
|
60
|
+
*
|
|
61
|
+
* Host applications implement this interface to provide TTS functionality.
|
|
62
|
+
* The adapter handles audio generation, caching (e.g., S3), and playback.
|
|
63
|
+
*
|
|
64
|
+
* Security: The adapter should NOT accept arbitrary text. Instead, it should
|
|
65
|
+
* fetch tour content from a trusted source (e.g., GitHub) using the context
|
|
66
|
+
* information provided.
|
|
67
|
+
*/
|
|
68
|
+
export interface TextToSpeechAdapter {
|
|
69
|
+
/**
|
|
70
|
+
* Fetch audio URLs for all steps in a tour
|
|
71
|
+
* This is called when the tour loads to ensure audio is available
|
|
72
|
+
*
|
|
73
|
+
* @param tourId - Unique identifier for the tour
|
|
74
|
+
* @param stepIds - Array of step IDs to fetch audio for
|
|
75
|
+
* @param context - Repository and file context
|
|
76
|
+
* @param options - Voice and playback options
|
|
77
|
+
* @returns Map of stepId -> audio URL
|
|
78
|
+
*/
|
|
79
|
+
fetchTourAudio(tourId: string, stepIds: string[], context: TourAudioContext, options?: TTSOptions): Promise<Map<string, string>>;
|
|
80
|
+
/**
|
|
81
|
+
* Play audio for a specific step
|
|
82
|
+
*
|
|
83
|
+
* @param stepId - The step ID to play audio for
|
|
84
|
+
* @throws Error if audio URL not found (fetchTourAudio must be called first)
|
|
85
|
+
*/
|
|
86
|
+
speak(stepId: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Stop current audio playback and reset position
|
|
89
|
+
*/
|
|
90
|
+
stop(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Pause current audio playback (preserves position)
|
|
93
|
+
*/
|
|
94
|
+
pause(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Resume paused audio playback
|
|
97
|
+
*/
|
|
98
|
+
resume(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Current state of the TTS system
|
|
101
|
+
*/
|
|
102
|
+
readonly state: TTSState;
|
|
103
|
+
/**
|
|
104
|
+
* Subscribe to TTS events
|
|
105
|
+
*
|
|
106
|
+
* @param event - Event type to listen for
|
|
107
|
+
* @param handler - Callback function
|
|
108
|
+
*/
|
|
109
|
+
addEventListener(event: TTSEvent, handler: () => void): void;
|
|
110
|
+
/**
|
|
111
|
+
* Unsubscribe from TTS events
|
|
112
|
+
*
|
|
113
|
+
* @param event - Event type to stop listening for
|
|
114
|
+
* @param handler - Callback function to remove
|
|
115
|
+
*/
|
|
116
|
+
removeEventListener(event: TTSEvent, handler: () => void): void;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=TextToSpeech.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextToSpeech.d.ts","sourceRoot":"","sources":["../../src/types/TextToSpeech.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;IAEnB,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAC;IAEnB,8BAA8B;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAElB,4BAA4B;IAC5B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAEpB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GA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@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tour Image Resolution Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utilities for resolving relative image paths to full URLs for tour cover images.
|
|
5
|
+
* The coverImage field is now natively supported in IntroductionTour and IntroductionTourStep
|
|
6
|
+
* from @principal-ai/file-city-builder v0.4.2+
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Repository context for resolving relative image paths
|
|
10
|
+
* Reuses the structure from TourAudioContext
|
|
11
|
+
*/
|
|
12
|
+
export interface ImageResolutionContext {
|
|
13
|
+
/** Repository owner (e.g., "anthropics") */
|
|
14
|
+
owner: string;
|
|
15
|
+
/** Repository name (e.g., "web-ade") */
|
|
16
|
+
repo: string;
|
|
17
|
+
/** Git commit SHA or branch name for consistent URLs */
|
|
18
|
+
ref: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a relative image path to a full GitHub raw URL
|
|
22
|
+
*
|
|
23
|
+
* @param relativePath - Path relative to repo root (e.g., "assets/cover.png")
|
|
24
|
+
* @param context - Repository context
|
|
25
|
+
* @returns Full URL to the image
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveImageUrl(relativePath: string, context: ImageResolutionContext): string;
|
|
28
|
+
//# sourceMappingURL=TourExtensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourExtensions.d.ts","sourceRoot":"","sources":["../../src/types/TourExtensions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IAEd,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IAEb,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,sBAAsB,GAC9B,MAAM,CAWR"}
|