@vscode/component-explorer 0.2.1-8 → 0.2.1-81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +104 -27
  2. package/dist/components/BottomDebugPanel.d.ts +8 -0
  3. package/dist/components/BottomDebugPanel.d.ts.map +1 -0
  4. package/dist/components/DebugPanelPlacement.d.ts +3 -0
  5. package/dist/components/DebugPanelPlacement.d.ts.map +1 -0
  6. package/dist/components/DebugWorkbench.d.ts +42 -0
  7. package/dist/components/DebugWorkbench.d.ts.map +1 -0
  8. package/dist/components/DebugWorkbenchLayout.d.ts +27 -0
  9. package/dist/components/DebugWorkbenchLayout.d.ts.map +1 -0
  10. package/dist/components/DebugWorkbenchState.d.ts +9 -0
  11. package/dist/components/DebugWorkbenchState.d.ts.map +1 -0
  12. package/dist/components/ExplorerModel.d.ts +14 -1
  13. package/dist/components/ExplorerModel.d.ts.map +1 -1
  14. package/dist/components/FixtureDebugStore.d.ts +20 -0
  15. package/dist/components/FixtureDebugStore.d.ts.map +1 -0
  16. package/dist/components/FixturePreviewItem.d.ts +10 -0
  17. package/dist/components/FixturePreviewItem.d.ts.map +1 -1
  18. package/dist/components/PageViewportState.d.ts +31 -0
  19. package/dist/components/PageViewportState.d.ts.map +1 -0
  20. package/dist/components/PreviewArea.d.ts.map +1 -1
  21. package/dist/components/RightSidebar.d.ts +8 -2
  22. package/dist/components/RightSidebar.d.ts.map +1 -1
  23. package/dist/components/icons.d.ts +8 -8
  24. package/dist/components/icons.d.ts.map +1 -1
  25. package/dist/core/ComponentRenderer.d.ts +23 -3
  26. package/dist/core/ComponentRenderer.d.ts.map +1 -1
  27. package/dist/core/ErrorInfo.d.ts +21 -1
  28. package/dist/core/ErrorInfo.d.ts.map +1 -1
  29. package/dist/core/FixtureInputStore.d.ts +32 -0
  30. package/dist/core/FixtureInputStore.d.ts.map +1 -0
  31. package/dist/core/FixtureInteractionRuntime.d.ts +29 -0
  32. package/dist/core/FixtureInteractionRuntime.d.ts.map +1 -0
  33. package/dist/core/FixtureNode.d.ts.map +1 -1
  34. package/dist/core/fixtureApi.d.ts +220 -32
  35. package/dist/core/fixtureApi.d.ts.map +1 -1
  36. package/dist/core/fixtureApiConsumer.d.ts +22 -2
  37. package/dist/core/fixtureApiConsumer.d.ts.map +1 -1
  38. package/dist/core/index.d.ts +7 -3
  39. package/dist/core/index.d.ts.map +1 -1
  40. package/dist/core/inputAggregation.d.ts +31 -0
  41. package/dist/core/inputAggregation.d.ts.map +1 -0
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +11 -9
  45. package/dist/lib/explorerQueryParams.d.ts +2 -2
  46. package/dist/lib/explorerQueryParams.d.ts.map +1 -1
  47. package/dist/lib/fixtureSizeCache.d.ts +2 -0
  48. package/dist/lib/fixtureSizeCache.d.ts.map +1 -1
  49. package/dist/modes/EmbeddedMode.d.ts +7 -0
  50. package/dist/modes/EmbeddedMode.d.ts.map +1 -1
  51. package/dist/modes/ExplorerUIMode.d.ts.map +1 -1
  52. package/dist/modes/HeadlessMode.d.ts +12 -3
  53. package/dist/modes/HeadlessMode.d.ts.map +1 -1
  54. package/dist/{runtimeVersion-C3nZZ7xj.js → runtimeVersion-wEb_3yeo.js} +74 -37
  55. package/dist/runtimeVersion-wEb_3yeo.js.map +1 -0
  56. package/dist/viewer.js +4448 -1908
  57. package/dist/viewer.js.map +1 -1
  58. package/package.json +15 -14
  59. package/dist/core/PropertySchema.d.ts +0 -40
  60. package/dist/core/PropertySchema.d.ts.map +0 -1
  61. package/dist/runtimeVersion-C3nZZ7xj.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"viewer.js","sources":["../src/core/fixtureApiConsumer.ts","../src/core/FixturePath.ts","../src/core/DisplayMode.ts","../src/core/FixtureNode.ts","../../../external/vscode-observables/observables/dist/observableInternal/logging/logging.js","../../../external/vscode-observables/observables/dist/observableInternal/debugLocation.js","../../../external/vscode-observables/observables/dist/observableInternal/debugName.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js","../../../external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js","../../../external/vscode-observables/observables/dist/disposables.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/derived.js","../../../external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js","../../../external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js","../../../external/vscode-observables/observables/dist/observableInternal/base.js","../../../external/vscode-observables/observables/dist/observableInternal/transaction.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js","../../../external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js","../../../external/vscode-observables/observables/dist/observableInternal/utils/utils.js","../../../external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js","../../../external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js","../../../external/vscode-observables/observables/dist/observableInternal/index.js","../src/core/FixtureRegistry.ts","../../../external/vscode-observables/observables-react/dist/ManualChangesHandler.js","../../../external/vscode-observables/observables-react/dist/IPropertyTransformer.js","../../../external/vscode-observables/observables-react/dist/utils.js","../../../external/vscode-observables/observables-react/dist/viewModel.js","../../../external/vscode-observables/observables-react/dist/obsView.js","../../../external/vscode-observables/observables-react/dist/view.js","../../../external/vscode-observables/observables-react/dist/viewWithModel.js","../../../external/vscode-observables/observables-react/dist/Value.js","../../../external/vscode-observables/observables-react/dist/di.js","../src/components/types.ts","../src/components/treeFilter.ts","../src/lib/localStorageObservable.ts","../src/lib/queryParamObservable.ts","../src/components/ExplorerModel.ts","../src/components/styles.ts","../src/components/TitleBarButton.tsx","../src/components/icons.tsx","../src/components/TitleBar.tsx","../src/components/TreeView.tsx","../src/components/SearchInput.tsx","../src/components/LeftSidebar.tsx","../src/components/RightSidebar.tsx","../src/lib/fixtureSizeCache.ts","../src/core/ConsoleEventsStore.ts","../src/core/ComponentRenderer.ts","../src/lib/explorerShadowHost.ts","../src/lib/fixtureFocusTrap.ts","../src/components/FixturePreviewItem.tsx","../src/components/FixtureScreenshotView.tsx","../src/components/ScreenshotComparisonRow.tsx","../src/components/ReportComparisonRow.tsx","../src/components/PreviewArea.tsx","../src/components/ConsolePanel.tsx","../src/components/Explorer.tsx","../../simple-api/dist/chunk-SGBCNXYH.mjs","../../simple-api/dist/chunk-TAEFVNPN.mjs","../src/daemon/DaemonModel.ts","../src/report/ReportModel.ts","../src/modes/ExplorerUIMode.ts","../src/modes/HeadlessMode.ts","../src/modes/EmbeddedMode.ts","../src/lib/explorerQueryParams.ts","../src/viewer.ts"],"sourcesContent":["/**\n * Fixture API Consumer\n * \n * This module validates and consumes fixture exports created by fixtureApi.\n * It provides type guards and parsing functions for cross-version compatibility.\n * \n * The viewer imports this module to parse fixtures; projects never need this.\n */\n\nimport {\n singleFixtureBrand,\n fixtureGroupBrand,\n fixtureVariantsBrand,\n type FixtureExport,\n type SingleFixtureExport,\n type FixtureGroupExport,\n type FixtureVariantsExport,\n type DisplayMode,\n type StyleDefinition,\n type RenderReturn,\n type RenderContext,\n} from './fixtureApi.js';\n\n// ============================================================================\n// Type guards (use these for runtime checks)\n// Cross-version compatible thanks to Symbol.for() in fixtureApi.ts\n// ============================================================================\n\n/**\n * Type guard for SingleFixtureExport.\n * Uses the global symbol brand for cross-version compatibility.\n */\nexport function isSingleFixture(value: unknown): value is SingleFixtureExport {\n return (\n typeof value === 'object' &&\n value !== null &&\n singleFixtureBrand in value &&\n (value as Record<symbol, unknown>)[singleFixtureBrand] === true &&\n '_options' in value &&\n typeof (value as { _options: unknown })._options === 'object'\n );\n}\n\n/**\n * Type guard for FixtureGroupExport.\n * Uses the global symbol brand for cross-version compatibility.\n */\nexport function isFixtureGroup(value: unknown): value is FixtureGroupExport {\n return (\n typeof value === 'object' &&\n value !== null &&\n fixtureGroupBrand in value &&\n (value as Record<symbol, unknown>)[fixtureGroupBrand] === true &&\n '_entries' in value &&\n typeof (value as { _entries: unknown })._entries === 'object'\n );\n}\n\n/**\n * Type guard for FixtureVariantsExport.\n * Uses the global symbol brand for cross-version compatibility.\n */\nexport function isFixtureVariants(value: unknown): value is FixtureVariantsExport {\n return (\n typeof value === 'object' &&\n value !== null &&\n fixtureVariantsBrand in value &&\n (value as Record<symbol, unknown>)[fixtureVariantsBrand] === true &&\n '_variants' in value &&\n typeof (value as { _variants: unknown })._variants === 'object'\n );\n}\n\n/**\n * Type guard for any fixture export type.\n */\nexport function isFixtureExport(value: unknown): value is FixtureExport {\n return isSingleFixture(value) || isFixtureGroup(value) || isFixtureVariants(value);\n}\n\n// ============================================================================\n// Parsing functions (validate and cast)\n// ============================================================================\n\nexport type ParseResult<T> =\n | { success: true; data: T }\n | { success: false; error: string };\n\n/**\n * Parses and validates a potential fixture export.\n * Returns a ParseResult with either the validated data or an error message.\n */\nexport function parseFixtureExport(value: unknown): ParseResult<FixtureExport> {\n if (isSingleFixture(value)) {\n return { success: true, data: value };\n }\n if (isFixtureGroup(value)) {\n return { success: true, data: value };\n }\n if (isFixtureVariants(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a valid fixture export (missing brand symbol or _options/_entries/_variants)' };\n}\n\n/**\n * Parses and validates a single fixture export.\n */\nexport function parseSingleFixture(value: unknown): ParseResult<SingleFixtureExport> {\n if (isSingleFixture(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a SingleFixtureExport' };\n}\n\n/**\n * Parses and validates a fixture group export.\n */\nexport function parseFixtureGroup(value: unknown): ParseResult<FixtureGroupExport> {\n if (isFixtureGroup(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a FixtureGroupExport' };\n}\n\n/**\n * Parses and validates a fixture variants export.\n */\nexport function parseFixtureVariants(value: unknown): ParseResult<FixtureVariantsExport> {\n if (isFixtureVariants(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a FixtureVariantsExport' };\n}\n\n// ============================================================================\n// ComponentDefinition creation (moved from defineFixture.ts)\n// ============================================================================\n\n/**\n * Definition of a component fixture (internal representation).\n */\nexport interface ComponentDefinition {\n /** Unique identifier within the fixture file */\n readonly id: string;\n\n /** Display name shown in the tree */\n readonly name: string;\n\n /** Optional description for documentation */\n readonly description?: string;\n\n /** How to isolate this component from other components */\n readonly isolation: 'none' | 'shadow-dom' | 'iframe';\n\n /** How to display: page (device viewport) or component (natural size) */\n readonly displayMode: DisplayMode;\n\n /** Stylesheets to inject (into document head, shadow root, or iframe head depending on isolation mode) */\n readonly styles?: readonly StyleDefinition[];\n\n /** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */\n readonly background: 'light' | 'dark';\n\n /** Labels for categorization and filtering */\n readonly labels: readonly string[];\n\n /** Accumulated expected visual descriptions (from self + parent groups/variants) */\n readonly expectedVisualDescriptions: readonly string[];\n\n /** Source file path this fixture was defined in */\n readonly sourceFile: string;\n\n /**\n * Render the component into the container.\n * Returns an optional RenderResult or Promise for cleanup and async readiness.\n */\n render(container: HTMLElement, context: RenderContext): RenderReturn;\n}\n\n/**\n * Creates the component definition from a validated SingleFixtureExport.\n */\nexport function createComponentDefinition(\n fixture: SingleFixtureExport,\n id: string,\n name: string,\n sourceFile: string,\n inheritedVisualDescriptions: readonly string[] = [],\n): ComponentDefinition {\n const options = fixture._options;\n const ownDescriptions = options.expectedVisualDescriptions\n ? (typeof options.expectedVisualDescriptions === 'string' ? [options.expectedVisualDescriptions] : [...options.expectedVisualDescriptions])\n : [];\n const expectedVisualDescriptions = [...inheritedVisualDescriptions, ...ownDescriptions];\n return {\n id,\n name,\n description: options.description,\n isolation: options.isolation ?? 'none',\n displayMode: options.displayMode ?? { type: 'component' },\n styles: options.styles,\n background: options.background ?? 'light',\n labels: options.labels ?? [],\n expectedVisualDescriptions,\n sourceFile,\n render: options.render,\n };\n}\n\n/**\n * Type guard for checking if a value is a ComponentDefinition.\n * @deprecated Use isSingleFixture or isFixtureGroup instead\n */\nexport function isComponentDefinition(value: unknown): value is ComponentDefinition {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'render' in value &&\n typeof (value as ComponentDefinition).render === 'function' &&\n 'id' in value &&\n 'name' in value\n );\n}\n","export class FixturePath {\n private _segments: readonly string[] | undefined;\n\n constructor(readonly value: string) {}\n\n get segments(): readonly string[] {\n return (this._segments ??= this.value.split('/'));\n }\n\n toString(): string {\n return this.value;\n }\n}\n","/**\n * Disposable resource that can be cleaned up.\n */\nexport interface Disposable {\n dispose(): void;\n}\n\n/**\n * Style definition for shadow DOM injection.\n */\nexport type StyleDefinition =\n | { readonly type: 'css'; readonly content: string }\n | { readonly type: 'url'; readonly href: string }\n | { readonly type: 'adopted'; readonly sheet: CSSStyleSheet };\n\n/**\n * Display mode for a component.\n */\nexport type DisplayMode = PageMode | ComponentMode;\n\n/**\n * Page mode - component fills a viewport with device presets.\n */\nexport interface PageMode {\n readonly type: 'page';\n /**\n * Device presets or custom viewport sizes.\n * When viewing, user can switch between these.\n */\n readonly viewports: ViewportPreset[];\n}\n\n/**\n * Component mode - renders at natural size.\n */\nexport interface ComponentMode {\n readonly type: 'component';\n}\n\n/**\n * Viewport preset - either a named preset or custom dimensions.\n */\nexport type ViewportPreset =\n | ViewportPresetName\n | { readonly name: string; readonly width: number; readonly height: number };\n\nexport type ViewportPresetName = 'mobile' | 'tablet' | 'desktop';\n\n/**\n * Standard viewport dimensions for presets.\n */\nexport const VIEWPORT_SIZES: Record<ViewportPresetName, { readonly width: number; readonly height: number }> = {\n mobile: { width: 390, height: 844 },\n tablet: { width: 768, height: 1024 },\n desktop: { width: 1440, height: 900 },\n};\n\n/**\n * Resolves a viewport preset to actual dimensions.\n */\nexport function resolveViewport(preset: ViewportPreset): { name: string; width: number; height: number } {\n if (typeof preset === 'string') {\n return { name: preset, ...VIEWPORT_SIZES[preset] };\n }\n return preset;\n}\n","import type { FixtureExport } from './fixtureApi.js';\nimport {\n isSingleFixture,\n isFixtureGroup,\n isFixtureVariants,\n createComponentDefinition,\n type ComponentDefinition,\n} from './fixtureApiConsumer.js';\nimport { FixturePath } from './FixturePath.js';\n\n/**\n * Validates a fixture path option.\n * @throws Error if path contains empty segments\n */\nfunction validatePath(path: string): void {\n if (path.startsWith('/')) {\n throw new Error(`Fixture path cannot start with '/': ${path}`);\n }\n if (path.includes('//')) {\n throw new Error(`Fixture path cannot contain empty segments: ${path}`);\n }\n if (path === '') {\n throw new Error(`Fixture path cannot be empty (use undefined for default)`);\n }\n}\n\n/**\n * Computes the tree path segments for a fixture.\n * @param filePath The file path of the fixture\n * @param pathOption The path option from the fixture export\n * @returns Array of path segments for the tree\n */\nfunction computePathSegments(filePath: string, pathOption: string | undefined): string[] {\n const baseName = extractBaseName(filePath);\n \n if (pathOption === undefined) {\n // No path → just filename\n return [baseName];\n } else if (pathOption.endsWith('/')) {\n // Trailing / → prefix, append filename\n const prefix = pathOption.slice(0, -1);\n if (prefix) {\n validatePath(prefix);\n return [...prefix.split('/'), baseName];\n }\n // Edge case: path is just \"/\" - invalid\n throw new Error(`Fixture path cannot be just '/': ${pathOption}`);\n } else {\n // Exact path, no filename appended\n validatePath(pathOption);\n return pathOption.split('/');\n }\n}\n\n/**\n * A node in the fixture tree.\n * Can be a folder (with children), variants (with children, horizontal layout), or a component leaf.\n */\nexport interface FixtureNode {\n readonly id: FixturePath;\n\n /** Display name */\n readonly name: string;\n\n /** Node type: folder for groups, variants for horizontal variant display, component for leaves */\n readonly type: 'folder' | 'variants' | 'component';\n\n /** Children (for folders and variants) */\n readonly children?: readonly FixtureNode[];\n\n /** Component definition (only for component nodes) */\n readonly component?: ComponentDefinition;\n\n /** Labels for categorization and filtering */\n readonly labels: readonly string[];\n\n /** Source fixture file path — present on skeleton nodes (component is undefined) for on-demand loading */\n readonly sourceFile?: string;\n}\n\n/**\n * Creates a fixture tree from a map of fixture exports.\n * Entries with `undefined` value are rendered as skeleton nodes (loaded on demand).\n */\nexport function createFixtureTree(fixtures: Map<string, FixtureExport>): FixtureNode {\n const root: MutableFixtureNode = {\n id: new FixturePath(''),\n name: 'Components',\n type: 'folder',\n children: [],\n labels: [],\n };\n\n for (const [filePath, fixtureExport] of fixtures) {\n if (fixtureExport === undefined) {\n // Skeleton: module not yet loaded — place a placeholder node using the file basename\n const name = extractBaseName(filePath);\n const skeletonNode: MutableFixtureNode = {\n id: new FixturePath(name),\n name,\n type: 'component',\n labels: [],\n sourceFile: filePath,\n };\n if (!root.children) root.children = [];\n root.children.push(skeletonNode);\n } else {\n const pathOption = '_path' in fixtureExport ? fixtureExport._path : undefined;\n const segments = computePathSegments(filePath, pathOption);\n addFixtureExportToTree(root, segments, fixtureExport, [], filePath);\n }\n }\n\n return root;\n}\n\n/**\n * Resolves all lazy fixture module loaders in parallel and returns a map of loaded exports.\n * Used by modes that need the full fixture tree upfront (headless, embedded).\n */\nexport async function resolveFixtureModules(\n modules: Record<string, () => Promise<{ default?: unknown }>>\n): Promise<Map<string, FixtureExport>> {\n const result = new Map<string, FixtureExport>();\n await Promise.all(\n Object.entries(modules).map(async ([path, loader]) => {\n const mod = await loader();\n const fixture = mod.default;\n if (fixture && typeof fixture === 'object') {\n result.set(path, fixture as FixtureExport);\n }\n })\n );\n return result;\n}\n\ninterface MutableFixtureNode {\n id: FixturePath;\n name: string;\n type: 'folder' | 'variants' | 'component';\n children?: MutableFixtureNode[];\n component?: ComponentDefinition;\n labels: string[];\n sourceFile?: string;\n}\n\nfunction extractBaseName(filePath: string): string {\n const fileName = filePath.split('/').pop() ?? filePath;\n // Remove .fixture.tsx, .fixture.ts, .fixture.jsx, .fixture.js\n return fileName.replace(/\\.fixture\\.(tsx?|jsx?)$/, '');\n}\n\nfunction addFixtureExportToTree(\n parent: MutableFixtureNode,\n pathSegments: string[],\n fixtureExport: FixtureExport,\n pathPrefix: string[] = [],\n sourceFile: string = '',\n inheritedVisualDescriptions: readonly string[] = [],\n): void {\n // Navigate/create folders for all segments except the last\n let current = parent;\n const accumulatedPath = [...pathPrefix];\n \n for (let i = 0; i < pathSegments.length - 1; i++) {\n const folderName = pathSegments[i];\n accumulatedPath.push(folderName);\n const folderId = new FixturePath(accumulatedPath.join('/'));\n \n let folder = current.children?.find(\n (c) => c.type === 'folder' && c.name === folderName\n );\n \n if (!folder) {\n folder = {\n id: folderId,\n name: folderName,\n type: 'folder',\n children: [],\n labels: [],\n };\n if (!current.children) {\n current.children = [];\n }\n current.children.push(folder);\n }\n current = folder;\n }\n \n // Now add the fixture at the final segment\n const finalSegment = pathSegments[pathSegments.length - 1];\n accumulatedPath.push(finalSegment);\n const fullId = new FixturePath(accumulatedPath.join('/'));\n \n if (isSingleFixture(fixtureExport)) {\n // Single fixture - add as leaf\n const def = createComponentDefinition(fixtureExport, fullId.value, finalSegment, sourceFile, inheritedVisualDescriptions);\n const componentNode: MutableFixtureNode = {\n id: fullId,\n name: finalSegment,\n type: 'component',\n component: def,\n labels: [...def.labels],\n };\n if (!current.children) {\n current.children = [];\n }\n current.children.push(componentNode);\n } else if (isFixtureGroup(fixtureExport)) {\n // Fixture group - create folder and recurse for entries\n let folder = current.children?.find(\n (c) => c.type === 'folder' && c.name === finalSegment\n );\n \n if (!folder) {\n folder = {\n id: fullId,\n name: finalSegment,\n type: 'folder',\n children: [],\n labels: [...(fixtureExport._labels ?? [])],\n };\n if (!current.children) {\n current.children = [];\n }\n current.children.push(folder);\n }\n\n // Add each entry in the group - recurse with accumulated path as prefix\n for (const [key, entry] of Object.entries(fixtureExport._entries)) {\n const own = fixtureExport._expectedVisualDescriptions;\n const ownArr = own ? (typeof own === 'string' ? [own] : [...own]) : [];\n const groupVisualDescriptions = [...inheritedVisualDescriptions, ...ownArr];\n addFixtureExportToTree(folder, [key], entry, accumulatedPath, sourceFile, groupVisualDescriptions);\n }\n } else if (isFixtureVariants(fixtureExport)) {\n // Fixture variants - create variants node with children\n const variantsNode: MutableFixtureNode = {\n id: fullId,\n name: finalSegment,\n type: 'variants',\n children: [],\n labels: [...(fixtureExport._labels ?? [])],\n };\n \n if (!current.children) {\n current.children = [];\n }\n current.children.push(variantsNode);\n\n // Add each variant as a child component\n for (const [key, variant] of Object.entries(fixtureExport._variants)) {\n const own = fixtureExport._expectedVisualDescriptions;\n const ownArr = own ? (typeof own === 'string' ? [own] : [...own]) : [];\n const variantVisualDescriptions = [...inheritedVisualDescriptions, ...ownArr];\n const childId = new FixturePath([...accumulatedPath, key].join('/'));\n const componentNode: MutableFixtureNode = {\n id: childId,\n name: key,\n type: 'component',\n component: createComponentDefinition(variant, childId.value, key, sourceFile, variantVisualDescriptions),\n labels: [...(variant._options.labels ?? [])],\n };\n variantsNode.children!.push(componentNode);\n }\n }\n}\n\n/**\n * Finds a node in the tree by path.\n */\nexport function findNodeByPath(root: FixtureNode, path: string[]): FixtureNode | undefined {\n if (path.length === 0) {\n return root;\n }\n\n let current: FixtureNode | undefined = root;\n \n for (const segment of path) {\n if (!current || !current.children) {\n return undefined;\n }\n current = current.children.find((c) => c.name === segment);\n }\n\n return current;\n}\n\n/**\n * Collects all component nodes from a subtree.\n */\nexport function collectComponents(node: FixtureNode): ComponentDefinition[] {\n if (node.type === 'component' && node.component) {\n return [node.component];\n }\n\n const components: ComponentDefinition[] = [];\n for (const child of node.children ?? []) {\n components.push(...collectComponents(child));\n }\n return components;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nlet globalObservableLogger;\nfunction addLogger(logger) {\n if (!globalObservableLogger) {\n globalObservableLogger = logger;\n }\n else if (globalObservableLogger instanceof ComposedLogger) {\n globalObservableLogger.loggers.push(logger);\n }\n else {\n globalObservableLogger = new ComposedLogger([globalObservableLogger, logger]);\n }\n}\nfunction getLogger() {\n return globalObservableLogger;\n}\nlet globalObservableLoggerFn = undefined;\nfunction setLogObservableFn(fn) {\n globalObservableLoggerFn = fn;\n}\nfunction logObservable(obs) {\n if (globalObservableLoggerFn) {\n globalObservableLoggerFn(obs);\n }\n}\nclass ComposedLogger {\n constructor(loggers) {\n this.loggers = loggers;\n }\n handleObservableCreated(observable, location) {\n for (const logger of this.loggers) {\n logger.handleObservableCreated(observable, location);\n }\n }\n handleOnListenerCountChanged(observable, newCount) {\n for (const logger of this.loggers) {\n logger.handleOnListenerCountChanged(observable, newCount);\n }\n }\n handleObservableUpdated(observable, info) {\n for (const logger of this.loggers) {\n logger.handleObservableUpdated(observable, info);\n }\n }\n handleAutorunCreated(autorun, location) {\n for (const logger of this.loggers) {\n logger.handleAutorunCreated(autorun, location);\n }\n }\n handleAutorunDisposed(autorun) {\n for (const logger of this.loggers) {\n logger.handleAutorunDisposed(autorun);\n }\n }\n handleAutorunDependencyChanged(autorun, observable, change) {\n for (const logger of this.loggers) {\n logger.handleAutorunDependencyChanged(autorun, observable, change);\n }\n }\n handleAutorunStarted(autorun) {\n for (const logger of this.loggers) {\n logger.handleAutorunStarted(autorun);\n }\n }\n handleAutorunFinished(autorun) {\n for (const logger of this.loggers) {\n logger.handleAutorunFinished(autorun);\n }\n }\n handleDerivedDependencyChanged(derived, observable, change) {\n for (const logger of this.loggers) {\n logger.handleDerivedDependencyChanged(derived, observable, change);\n }\n }\n handleDerivedCleared(observable) {\n for (const logger of this.loggers) {\n logger.handleDerivedCleared(observable);\n }\n }\n handleBeginTransaction(transaction) {\n for (const logger of this.loggers) {\n logger.handleBeginTransaction(transaction);\n }\n }\n handleEndTransaction(transaction) {\n for (const logger of this.loggers) {\n logger.handleEndTransaction(transaction);\n }\n }\n}\n\nexport { addLogger, getLogger, logObservable, setLogObservableFn };\n//# sourceMappingURL=logging.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar DebugLocation;\n(function (DebugLocation) {\n let enabled = false;\n function enable() {\n enabled = true;\n }\n DebugLocation.enable = enable;\n function ofCaller() {\n return ofNthCaller(1);\n }\n DebugLocation.ofCaller = ofCaller;\n function ofNthCaller(n) {\n if (!enabled) {\n return undefined;\n }\n const Err = Error; // For the monaco editor checks, which don't have the nodejs types.\n const l = Err.stackTraceLimit;\n Err.stackTraceLimit = 3;\n const stack = new Error().stack;\n Err.stackTraceLimit = l;\n return DebugLocationImpl.fromStack(stack, n + 1);\n }\n DebugLocation.ofNthCaller = ofNthCaller;\n})(DebugLocation || (DebugLocation = {}));\nclass DebugLocationImpl {\n static fromStack(stack, parentIdx) {\n const lines = stack.split('\\n');\n const location = parseLine(lines[parentIdx + 1]);\n if (location) {\n return new DebugLocationImpl(location.fileName, location.line, location.column, location.id);\n }\n else {\n return undefined;\n }\n }\n constructor(fileName, line, column, id) {\n this.fileName = fileName;\n this.line = line;\n this.column = column;\n this.id = id;\n }\n}\nfunction parseLine(stackLine) {\n if (!stackLine) {\n return undefined;\n }\n const match = stackLine.match(/\\((.*):(\\d+):(\\d+)\\)/);\n if (match) {\n return {\n fileName: match[1],\n line: parseInt(match[2]),\n column: parseInt(match[3]),\n id: stackLine,\n };\n }\n const match2 = stackLine.match(/at ([^\\(\\)]*):(\\d+):(\\d+)/);\n if (match2) {\n return {\n fileName: match2[1],\n line: parseInt(match2[2]),\n column: parseInt(match2[3]),\n id: stackLine,\n };\n }\n return undefined;\n}\n\nexport { DebugLocation };\n//# sourceMappingURL=debugLocation.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass DebugNameData {\n constructor(owner, debugNameSource, referenceFn) {\n this.owner = owner;\n this.debugNameSource = debugNameSource;\n this.referenceFn = referenceFn;\n }\n getDebugName(target) {\n return getDebugName(target, this);\n }\n}\nconst countPerName = new Map();\nconst cachedDebugName = new WeakMap();\nfunction getDebugName(target, data) {\n const cached = cachedDebugName.get(target);\n if (cached) {\n return cached;\n }\n const dbgName = computeDebugName(target, data);\n if (dbgName) {\n let count = countPerName.get(dbgName) ?? 0;\n count++;\n countPerName.set(dbgName, count);\n const result = count === 1 ? dbgName : `${dbgName}#${count}`;\n cachedDebugName.set(target, result);\n return result;\n }\n return undefined;\n}\nfunction computeDebugName(self, data) {\n const cached = cachedDebugName.get(self);\n if (cached) {\n return cached;\n }\n const ownerStr = data.owner ? formatOwner(data.owner) + `.` : '';\n let result;\n const debugNameSource = data.debugNameSource;\n if (debugNameSource !== undefined) {\n if (typeof debugNameSource === 'function') {\n result = debugNameSource();\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n else {\n return ownerStr + debugNameSource;\n }\n }\n const referenceFn = data.referenceFn;\n if (referenceFn !== undefined) {\n result = getFunctionName(referenceFn);\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n if (data.owner !== undefined) {\n const key = findKey(data.owner, self);\n if (key !== undefined) {\n return ownerStr + key;\n }\n }\n return undefined;\n}\nfunction findKey(obj, value) {\n for (const key in obj) {\n if (obj[key] === value) {\n return key;\n }\n }\n return undefined;\n}\nconst countPerClassName = new Map();\nconst ownerId = new WeakMap();\nfunction formatOwner(owner) {\n const id = ownerId.get(owner);\n if (id) {\n return id;\n }\n const className = getClassName(owner) ?? 'Object';\n let count = countPerClassName.get(className) ?? 0;\n count++;\n countPerClassName.set(className, count);\n const result = count === 1 ? className : `${className}#${count}`;\n ownerId.set(owner, result);\n return result;\n}\nfunction getClassName(obj) {\n const ctor = obj.constructor;\n if (ctor) {\n if (ctor.name === 'Object') {\n return undefined;\n }\n return ctor.name;\n }\n return undefined;\n}\nfunction getFunctionName(fn) {\n const fnSrc = fn.toString();\n // Pattern: /** @description ... */\n const regexp = /\\/\\*\\*\\s*@description\\s*([^*]*)\\*\\//;\n const match = regexp.exec(fnSrc);\n const result = match ? match[1] : undefined;\n return result?.trim();\n}\n\nexport { DebugNameData, getClassName, getDebugName, getFunctionName };\n//# sourceMappingURL=debugName.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugLocation } from '../debugLocation.js';\nimport { getFunctionName } from '../debugName.js';\nimport { logObservable, getLogger } from '../logging/logging.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nlet _derived;\n/**\n * @internal\n * This is to allow splitting files.\n*/\nfunction _setDerivedOpts(derived) {\n _derived = derived;\n}\nlet _recomputeInitiallyAndOnChange;\nfunction _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange) {\n _recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange;\n}\nlet _keepObserved;\nfunction _setKeepObserved(keepObserved) {\n _keepObserved = keepObserved;\n}\nlet _debugGetDependencyGraph;\nfunction _setDebugGetDependencyGraph(debugGetDependencyGraph) {\n _debugGetDependencyGraph = debugGetDependencyGraph;\n}\nclass ConvenientObservable {\n get TChange() { return null; }\n reportChanges() {\n this.get();\n }\n /** @sealed */\n read(reader) {\n if (reader) {\n return reader.readObservable(this);\n }\n else {\n return this.get();\n }\n }\n map(fnOrOwner, fnOrUndefined, debugLocation = DebugLocation.ofCaller()) {\n const owner = fnOrUndefined === undefined ? undefined : fnOrOwner;\n const fn = fnOrUndefined === undefined ? fnOrOwner : fnOrUndefined;\n return _derived({\n owner,\n debugName: () => {\n const name = getFunctionName(fn);\n if (name !== undefined) {\n return name;\n }\n // regexp to match `x => x.y` or `x => x?.y` where x and y can be arbitrary identifiers (uses backref):\n const regexp = /^\\s*\\(?\\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*\\)?\\s*=>\\s*\\1(?:\\??)\\.([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*$/;\n const match = regexp.exec(fn.toString());\n if (match) {\n return `${this.debugName}.${match[2]}`;\n }\n if (!owner) {\n return `${this.debugName} (mapped)`;\n }\n return undefined;\n },\n debugReferenceFn: fn,\n }, (reader) => fn(this.read(reader), reader), debugLocation);\n }\n /**\n * @sealed\n * Converts an observable of an observable value into a direct observable of the value.\n */\n flatten() {\n return _derived({\n owner: undefined,\n debugName: () => `${this.debugName} (flattened)`,\n }, (reader) => this.read(reader).read(reader));\n }\n recomputeInitiallyAndOnChange(store, handleValue) {\n store.add(_recomputeInitiallyAndOnChange(this, handleValue));\n return this;\n }\n /**\n * Ensures that this observable is observed. This keeps the cache alive.\n * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).\n * Use `recomputeInitiallyAndOnChange` for eager evaluation.\n */\n keepObserved(store) {\n store.add(_keepObserved(this));\n return this;\n }\n get debugValue() {\n return this.get();\n }\n debugGetDependencyGraph() {\n return _debugGetDependencyGraph(this);\n }\n}\nclass BaseObservable extends ConvenientObservable {\n constructor(debugLocation) {\n super();\n this._observers = new Set();\n getLogger()?.handleObservableCreated(this, debugLocation);\n }\n addObserver(observer) {\n const len = this._observers.size;\n this._observers.add(observer);\n if (len === 0) {\n this.onFirstObserverAdded();\n }\n if (len !== this._observers.size) {\n getLogger()?.handleOnListenerCountChanged(this, this._observers.size);\n }\n }\n removeObserver(observer) {\n const deleted = this._observers.delete(observer);\n if (deleted && this._observers.size === 0) {\n this.onLastObserverRemoved();\n }\n if (deleted) {\n getLogger()?.handleOnListenerCountChanged(this, this._observers.size);\n }\n }\n onFirstObserverAdded() { }\n onLastObserverRemoved() { }\n log() {\n const hadLogger = !!getLogger();\n logObservable(this);\n if (!hadLogger) {\n getLogger()?.handleObservableCreated(this, DebugLocation.ofCaller());\n }\n return this;\n }\n debugGetObservers() {\n return this._observers;\n }\n}\n\nexport { BaseObservable, ConvenientObservable, _setDebugGetDependencyGraph, _setDerivedOpts, _setKeepObserved, _setRecomputeInitiallyAndOnChange };\n//# sourceMappingURL=baseObservable.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction toDisposable(fn) {\n return {\n dispose: fn\n };\n}\nclass BugIndicatingError extends Error {\n constructor(message) {\n super(message || 'An unexpected bug occurred.');\n Object.setPrototypeOf(this, BugIndicatingError.prototype);\n // Because we know for sure only buggy code throws this,\n // we definitely want to break here and fix the bug.\n // eslint-disable-next-line no-debugger\n // debugger;\n }\n}\nfunction onBugIndicatingError(error) {\n // debugger;\n throw error;\n}\nfunction onUnexpectedError(error) {\n console.error('Unexpected error:', error);\n}\n/**\n * Compares two items for equality using strict equality.\n*/\nconst strictEquals = (a, b) => a === b;\n\nexport { BugIndicatingError, onBugIndicatingError, onUnexpectedError, strictEquals, toDisposable };\n//# sourceMappingURL=deps.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass DisposableStore {\n constructor() {\n this.disposables = [];\n this._isDisposed = false;\n }\n get isDisposed() { return this._isDisposed; }\n dispose() {\n this.clear();\n this._isDisposed = true;\n }\n add(disposable) {\n if (disposable) {\n this.disposables.push(disposable);\n }\n return disposable;\n }\n remove(disposable) {\n if (!disposable) {\n return disposable;\n }\n const index = this.disposables.indexOf(disposable);\n if (index !== -1) {\n this.disposables.splice(index, 1);\n }\n return disposable;\n }\n clear() {\n for (const disposable of this.disposables) {\n disposable.dispose();\n }\n this.disposables = [];\n }\n leakItems() {\n this.disposables = [];\n }\n}\nclass Disposable {\n constructor() {\n this._store = new DisposableStore();\n }\n dispose() {\n this._store.dispose();\n }\n _register(t) {\n this._store.add(t);\n return t;\n }\n _registerOrDispose(t) {\n if (t) {\n if (this._store.isDisposed) {\n t.dispose();\n }\n else {\n this._store.add(t);\n }\n }\n return t;\n }\n}\n\nexport { Disposable, DisposableStore };\n//# sourceMappingURL=disposables.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BaseObservable } from './baseObservable.js';\nimport { BugIndicatingError, onBugIndicatingError } from '../commonFacade/deps.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction derivedStateToString(state) {\n switch (state) {\n case 0 /* DerivedState.initial */: return 'initial';\n case 1 /* DerivedState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';\n case 2 /* DerivedState.stale */: return 'stale';\n case 3 /* DerivedState.upToDate */: return 'upToDate';\n default: return '<unknown>';\n }\n}\nclass Derived extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? '(anonymous)';\n }\n constructor(_debugNameData, _computeFn, _changeTracker, _handleLastObserverRemoved = undefined, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._computeFn = _computeFn;\n this._changeTracker = _changeTracker;\n this._handleLastObserverRemoved = _handleLastObserverRemoved;\n this._equalityComparator = _equalityComparator;\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n this._updateCount = 0;\n this._dependencies = new Set();\n this._dependenciesToBeRemoved = new Set();\n this._changeSummary = undefined;\n this._isUpdating = false;\n this._isComputing = false;\n this._didReportChange = false;\n this._isInBeforeUpdate = false;\n this._isReaderValid = false;\n this._store = undefined;\n this._delayedStore = undefined;\n this._removedObserverToCallEndUpdateOn = null;\n this._changeSummary = this._changeTracker?.createChangeSummary(undefined);\n }\n onLastObserverRemoved() {\n /**\n * We are not tracking changes anymore, thus we have to assume\n * that our cache is invalid.\n */\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n getLogger()?.handleDerivedCleared(this);\n for (const d of this._dependencies) {\n d.removeObserver(this);\n }\n this._dependencies.clear();\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n if (this._delayedStore !== undefined) {\n this._delayedStore.dispose();\n this._delayedStore = undefined;\n }\n this._handleLastObserverRemoved?.();\n }\n get() {\n const checkEnabled = false; // TODO set to true\n if (this._isComputing && checkEnabled) {\n // investigate why this fails in the diff editor!\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n if (this._observers.size === 0) {\n let result;\n // Without observers, we don't know when to clean up stuff.\n // Thus, we don't cache anything to prevent memory leaks.\n try {\n this._isReaderValid = true;\n let changeSummary = undefined;\n if (this._changeTracker) {\n changeSummary = this._changeTracker.createChangeSummary(undefined);\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n }\n result = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\n }\n // Clear new dependencies\n this.onLastObserverRemoved();\n return result;\n }\n else {\n do {\n // We might not get a notification for a dependency that changed while it is updating,\n // thus we also have to ask all our depedencies if they changed in this case.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n for (const d of this._dependencies) {\n /** might call {@link handleChange} indirectly, which could make us stale */\n d.reportChanges();\n if (this._state === 2 /* DerivedState.stale */) {\n // The other dependencies will refresh on demand, so early break\n break;\n }\n }\n }\n // We called report changes of all dependencies.\n // If we are still not stale, we can assume to be up to date again.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n this._state = 3 /* DerivedState.upToDate */;\n }\n if (this._state !== 3 /* DerivedState.upToDate */) {\n this._recompute();\n }\n // In case recomputation changed one of our dependencies, we need to recompute again.\n } while (this._state !== 3 /* DerivedState.upToDate */);\n return this._value;\n }\n }\n _recompute() {\n let didChange = false;\n this._isComputing = true;\n this._didReportChange = false;\n const emptySet = this._dependenciesToBeRemoved;\n this._dependenciesToBeRemoved = this._dependencies;\n this._dependencies = emptySet;\n try {\n const changeSummary = this._changeSummary;\n this._isReaderValid = true;\n if (this._changeTracker) {\n this._isInBeforeUpdate = true;\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n this._isInBeforeUpdate = false;\n this._changeSummary = this._changeTracker?.createChangeSummary(changeSummary);\n }\n const hadValue = this._state !== 0 /* DerivedState.initial */;\n const oldValue = this._value;\n this._state = 3 /* DerivedState.upToDate */;\n const delayedStore = this._delayedStore;\n if (delayedStore !== undefined) {\n this._delayedStore = undefined;\n }\n try {\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n /** might call {@link handleChange} indirectly, which could invalidate us */\n this._value = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\n // We don't want our observed observables to think that they are (not even temporarily) not being observed.\n // Thus, we only unsubscribe from observables that are definitely not read anymore.\n for (const o of this._dependenciesToBeRemoved) {\n o.removeObserver(this);\n }\n this._dependenciesToBeRemoved.clear();\n if (delayedStore !== undefined) {\n delayedStore.dispose();\n }\n }\n didChange = this._didReportChange || (hadValue && !(this._equalityComparator(oldValue, this._value)));\n getLogger()?.handleObservableUpdated(this, {\n oldValue,\n newValue: this._value,\n change: undefined,\n didChange,\n hadValue,\n });\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n this._isComputing = false;\n if (!this._didReportChange && didChange) {\n for (const r of this._observers) {\n r.handleChange(this, undefined);\n }\n }\n else {\n this._didReportChange = false;\n }\n }\n toString() {\n return `LazyDerived<${this.debugName}>`;\n }\n // IObserver Implementation\n beginUpdate(_observable) {\n if (this._isUpdating) {\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n this._updateCount++;\n this._isUpdating = true;\n try {\n const propagateBeginUpdate = this._updateCount === 1;\n if (this._state === 3 /* DerivedState.upToDate */) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n // If we propagate begin update, that will already signal a possible change.\n if (!propagateBeginUpdate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n if (propagateBeginUpdate) {\n for (const r of this._observers) {\n r.beginUpdate(this); // This signals a possible change\n }\n }\n }\n finally {\n this._isUpdating = false;\n }\n }\n endUpdate(_observable) {\n this._updateCount--;\n if (this._updateCount === 0) {\n // End update could change the observer list.\n const observers = [...this._observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n if (this._removedObserverToCallEndUpdateOn) {\n const observers = [...this._removedObserverToCallEndUpdateOn];\n this._removedObserverToCallEndUpdateOn = null;\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n }\n }\n handlePossibleChange(observable) {\n // In all other states, observers already know that we might have changed.\n if (this._state === 3 /* DerivedState.upToDate */ && this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable)) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n handleChange(observable, change) {\n if (this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable) || this._isInBeforeUpdate) {\n getLogger()?.handleDerivedDependencyChanged(this, observable, change);\n let shouldReact = false;\n try {\n shouldReact = this._changeTracker ? this._changeTracker.handleChange({\n changedObservable: observable,\n change,\n didChange: (o) => o === observable,\n }, this._changeSummary) : true;\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n const wasUpToDate = this._state === 3 /* DerivedState.upToDate */;\n if (shouldReact && (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */ || wasUpToDate)) {\n this._state = 2 /* DerivedState.stale */;\n if (wasUpToDate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n }\n }\n // IReader Implementation\n _ensureReaderValid() {\n if (!this._isReaderValid) {\n throw new BugIndicatingError('The reader object cannot be used outside its compute function!');\n }\n }\n readObservable(observable) {\n this._ensureReaderValid();\n // Subscribe before getting the value to enable caching\n observable.addObserver(this);\n /** This might call {@link handleChange} indirectly, which could invalidate us */\n const value = observable.get();\n // Which is why we only add the observable to the dependencies now.\n this._dependencies.add(observable);\n this._dependenciesToBeRemoved.delete(observable);\n return value;\n }\n reportChange(change) {\n this._ensureReaderValid();\n this._didReportChange = true;\n // TODO add logging\n for (const r of this._observers) {\n r.handleChange(this, change);\n }\n }\n get store() {\n this._ensureReaderValid();\n if (this._store === undefined) {\n this._store = new DisposableStore();\n }\n return this._store;\n }\n get delayedStore() {\n this._ensureReaderValid();\n if (this._delayedStore === undefined) {\n this._delayedStore = new DisposableStore();\n }\n return this._delayedStore;\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCount > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n if (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(observer)) {\n this._removedObserverToCallEndUpdateOn.delete(observer);\n }\n else {\n observer.beginUpdate(this);\n }\n }\n }\n removeObserver(observer) {\n if (this._observers.has(observer) && this._updateCount > 0) {\n if (!this._removedObserverToCallEndUpdateOn) {\n this._removedObserverToCallEndUpdateOn = new Set();\n }\n this._removedObserverToCallEndUpdateOn.add(observer);\n }\n super.removeObserver(observer);\n }\n debugGetState() {\n return {\n state: this._state,\n stateStr: derivedStateToString(this._state),\n updateCount: this._updateCount,\n isComputing: this._isComputing,\n dependencies: this._dependencies,\n value: this._value,\n };\n }\n debugSetValue(newValue) {\n this._value = newValue;\n }\n debugRecompute() {\n if (!this._isComputing) {\n this._recompute();\n }\n else {\n this._state = 2 /* DerivedState.stale */;\n }\n }\n setValue(newValue, tx, change) {\n this._value = newValue;\n const observers = this._observers;\n tx.updateObserver(this, this);\n for (const d of observers) {\n d.handleChange(this, change);\n }\n }\n}\nclass DerivedWithSetter extends Derived {\n constructor(debugNameData, computeFn, changeTracker, handleLastObserverRemoved = undefined, equalityComparator, set, debugLocation) {\n super(debugNameData, computeFn, changeTracker, handleLastObserverRemoved, equalityComparator, debugLocation);\n this.set = set;\n }\n}\n\nexport { Derived, DerivedWithSetter };\n//# sourceMappingURL=derivedImpl.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugLocation } from '../debugLocation.js';\nimport { DebugNameData } from '../debugName.js';\nimport { _setDerivedOpts } from './baseObservable.js';\nimport { Derived, DerivedWithSetter } from './derivedImpl.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction derived(computeFnOrOwner, computeFn, debugLocation = DebugLocation.ofCaller()) {\n if (computeFn !== undefined) {\n return new Derived(new DebugNameData(computeFnOrOwner, undefined, computeFn), computeFn, undefined, undefined, strictEquals, debugLocation);\n }\n return new Derived(new DebugNameData(undefined, undefined, computeFnOrOwner), computeFnOrOwner, undefined, undefined, strictEquals, debugLocation);\n}\nfunction derivedWithSetter(owner, computeFn, setter, debugLocation = DebugLocation.ofCaller()) {\n return new DerivedWithSetter(new DebugNameData(owner, undefined, computeFn), computeFn, undefined, undefined, strictEquals, setter, debugLocation);\n}\nfunction derivedOpts(options, computeFn, debugLocation = DebugLocation.ofCaller()) {\n return new Derived(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn), computeFn, undefined, options.onLastObserverRemoved, options.equalsFn ?? strictEquals, debugLocation);\n}\n_setDerivedOpts(derivedOpts);\n/**\n * Represents an observable that is derived from other observables.\n * The value is only recomputed when absolutely needed.\n *\n * {@link computeFn} should start with a JS Doc using `@description` to name the derived.\n *\n * Use `createEmptyChangeSummary` to create a \"change summary\" that can collect the changes.\n * Use `handleChange` to add a reported change to the change summary.\n * The compute function is given the last change summary.\n * The change summary is discarded after the compute function was called.\n *\n * @see derived\n */\nfunction derivedHandleChanges(options, computeFn, debugLocation = DebugLocation.ofCaller()) {\n return new Derived(new DebugNameData(options.owner, options.debugName, undefined), computeFn, options.changeTracker, undefined, options.equalityComparer ?? strictEquals, debugLocation);\n}\nfunction derivedWithStore(computeFnOrOwner, computeFnOrUndefined, debugLocation = DebugLocation.ofCaller()) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n // Intentionally re-assigned in case an inactive observable is re-used later\n // eslint-disable-next-line local/code-no-potentially-unsafe-disposables\n let store = new DisposableStore();\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n if (store.isDisposed) {\n store = new DisposableStore();\n }\n else {\n store.clear();\n }\n return computeFn(r, store);\n }, undefined, () => store.dispose(), strictEquals, debugLocation);\n}\nfunction derivedDisposable(computeFnOrOwner, computeFnOrUndefined, debugLocation = DebugLocation.ofCaller()) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n let store = undefined;\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n if (!store) {\n store = new DisposableStore();\n }\n else {\n store.clear();\n }\n const result = computeFn(r);\n if (result) {\n store.add(result);\n }\n return result;\n }, undefined, () => {\n if (store) {\n store.dispose();\n store = undefined;\n }\n }, strictEquals, debugLocation);\n}\n\nexport { derived, derivedDisposable, derivedHandleChanges, derivedOpts, derivedWithSetter, derivedWithStore };\n//# sourceMappingURL=derived.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { onBugIndicatingError, BugIndicatingError } from '../commonFacade/deps.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction autorunStateToString(state) {\n switch (state) {\n case 1 /* AutorunState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';\n case 2 /* AutorunState.stale */: return 'stale';\n case 3 /* AutorunState.upToDate */: return 'upToDate';\n default: return '<unknown>';\n }\n}\nclass AutorunObserver {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? '(anonymous)';\n }\n constructor(_debugNameData, _runFn, _changeTracker, debugLocation) {\n this._debugNameData = _debugNameData;\n this._runFn = _runFn;\n this._changeTracker = _changeTracker;\n this._state = 2 /* AutorunState.stale */;\n this._updateCount = 0;\n this._disposed = false;\n this._dependencies = new Set();\n this._dependenciesToBeRemoved = new Set();\n this._isRunning = false;\n this._store = undefined;\n this._delayedStore = undefined;\n this._changeSummary = this._changeTracker?.createChangeSummary(undefined);\n getLogger()?.handleAutorunCreated(this, debugLocation);\n this._run();\n }\n dispose() {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n for (const o of this._dependencies) {\n o.removeObserver(this); // Warning: external call!\n }\n this._dependencies.clear();\n if (this._store !== undefined) {\n this._store.dispose();\n }\n if (this._delayedStore !== undefined) {\n this._delayedStore.dispose();\n }\n getLogger()?.handleAutorunDisposed(this);\n }\n _run() {\n const emptySet = this._dependenciesToBeRemoved;\n this._dependenciesToBeRemoved = this._dependencies;\n this._dependencies = emptySet;\n this._state = 3 /* AutorunState.upToDate */;\n try {\n if (!this._disposed) {\n getLogger()?.handleAutorunStarted(this);\n const changeSummary = this._changeSummary;\n const delayedStore = this._delayedStore;\n if (delayedStore !== undefined) {\n this._delayedStore = undefined;\n }\n try {\n this._isRunning = true;\n if (this._changeTracker) {\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n this._changeSummary = this._changeTracker.createChangeSummary(changeSummary); // Warning: external call!\n }\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n this._runFn(this, changeSummary); // Warning: external call!\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n finally {\n this._isRunning = false;\n if (delayedStore !== undefined) {\n delayedStore.dispose();\n }\n }\n }\n }\n finally {\n if (!this._disposed) {\n getLogger()?.handleAutorunFinished(this);\n }\n // We don't want our observed observables to think that they are (not even temporarily) not being observed.\n // Thus, we only unsubscribe from observables that are definitely not read anymore.\n for (const o of this._dependenciesToBeRemoved) {\n o.removeObserver(this); // Warning: external call!\n }\n this._dependenciesToBeRemoved.clear();\n }\n }\n toString() {\n return `Autorun<${this.debugName}>`;\n }\n // IObserver implementation\n beginUpdate(_observable) {\n if (this._state === 3 /* AutorunState.upToDate */) {\n this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n this._updateCount++;\n }\n endUpdate(_observable) {\n try {\n if (this._updateCount === 1) {\n do {\n if (this._state === 1 /* AutorunState.dependenciesMightHaveChanged */) {\n this._state = 3 /* AutorunState.upToDate */;\n for (const d of this._dependencies) {\n d.reportChanges(); // Warning: external call!\n if (this._state === 2 /* AutorunState.stale */) {\n // The other dependencies will refresh on demand\n break;\n }\n }\n }\n if (this._state !== 3 /* AutorunState.upToDate */) {\n this._run(); // Warning: indirect external call!\n }\n } while (this._state !== 3 /* AutorunState.upToDate */);\n }\n }\n finally {\n this._updateCount--;\n }\n }\n handlePossibleChange(observable) {\n if (this._state === 3 /* AutorunState.upToDate */ && this._isDependency(observable)) {\n this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n }\n handleChange(observable, change) {\n if (this._isDependency(observable)) {\n getLogger()?.handleAutorunDependencyChanged(this, observable, change);\n try {\n // Warning: external call!\n const shouldReact = this._changeTracker ? this._changeTracker.handleChange({\n changedObservable: observable,\n change,\n didChange: (o) => o === observable,\n }, this._changeSummary) : true;\n if (shouldReact) {\n this._state = 2 /* AutorunState.stale */;\n }\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n }\n }\n _isDependency(observable) {\n return this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable);\n }\n // IReader implementation\n _ensureNoRunning() {\n if (!this._isRunning) {\n throw new BugIndicatingError('The reader object cannot be used outside its compute function!');\n }\n }\n readObservable(observable) {\n this._ensureNoRunning();\n // In case the run action disposes the autorun\n if (this._disposed) {\n return observable.get(); // warning: external call!\n }\n observable.addObserver(this); // warning: external call!\n const value = observable.get(); // warning: external call!\n this._dependencies.add(observable);\n this._dependenciesToBeRemoved.delete(observable);\n return value;\n }\n get store() {\n this._ensureNoRunning();\n if (this._disposed) {\n throw new BugIndicatingError('Cannot access store after dispose');\n }\n if (this._store === undefined) {\n this._store = new DisposableStore();\n }\n return this._store;\n }\n get delayedStore() {\n this._ensureNoRunning();\n if (this._disposed) {\n throw new BugIndicatingError('Cannot access store after dispose');\n }\n if (this._delayedStore === undefined) {\n this._delayedStore = new DisposableStore();\n }\n return this._delayedStore;\n }\n debugGetState() {\n return {\n isRunning: this._isRunning,\n updateCount: this._updateCount,\n dependencies: this._dependencies,\n state: this._state,\n stateStr: autorunStateToString(this._state),\n };\n }\n debugRerun() {\n if (!this._isRunning) {\n this._run();\n }\n else {\n this._state = 2 /* AutorunState.stale */;\n }\n }\n}\n\nexport { AutorunObserver };\n//# sourceMappingURL=autorunImpl.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { toDisposable } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { AutorunObserver } from './autorunImpl.js';\nimport { DebugLocation } from '../debugLocation.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n */\nfunction autorun(fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(undefined, undefined, fn), fn, undefined, debugLocation);\n}\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n */\nfunction autorunOpts(options, fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, undefined, debugLocation);\n}\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n *\n * Use `changeTracker.createChangeSummary` to create a \"change summary\" that can collect the changes.\n * Use `changeTracker.handleChange` to add a reported change to the change summary.\n * The run function is given the last change summary.\n * The change summary is discarded after the run function was called.\n *\n * @see autorun\n */\nfunction autorunHandleChanges(options, fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, options.changeTracker, debugLocation);\n}\n/**\n * @see autorunHandleChanges (but with a disposable store that is cleared before the next run or on dispose)\n */\nfunction autorunWithStoreHandleChanges(options, fn) {\n const store = new DisposableStore();\n const disposable = autorunHandleChanges({\n owner: options.owner,\n debugName: options.debugName,\n debugReferenceFn: options.debugReferenceFn ?? fn,\n changeTracker: options.changeTracker,\n }, (reader, changeSummary) => {\n store.clear();\n fn(reader, changeSummary, store);\n });\n return toDisposable(() => {\n disposable.dispose();\n store.dispose();\n });\n}\n/**\n * @see autorun (but with a disposable store that is cleared before the next run or on dispose)\n *\n * @deprecated Use `autorun(reader => { reader.store.add(...) })` instead!\n */\nfunction autorunWithStore(fn) {\n const store = new DisposableStore();\n const disposable = autorunOpts({\n owner: undefined,\n debugName: undefined,\n debugReferenceFn: fn,\n }, reader => {\n store.clear();\n fn(reader, store);\n });\n return toDisposable(() => {\n disposable.dispose();\n store.dispose();\n });\n}\nfunction autorunDelta(observable, handler) {\n let _lastValue;\n return autorunOpts({ debugReferenceFn: handler }, (reader) => {\n const newValue = observable.read(reader);\n const lastValue = _lastValue;\n _lastValue = newValue;\n handler({ lastValue, newValue });\n });\n}\nfunction autorunIterableDelta(getValue, handler, getUniqueIdentifier = v => v) {\n const lastValues = new Map();\n return autorunOpts({ debugReferenceFn: getValue }, (reader) => {\n const newValues = new Map();\n const removedValues = new Map(lastValues);\n for (const value of getValue(reader)) {\n const id = getUniqueIdentifier(value);\n if (lastValues.has(id)) {\n removedValues.delete(id);\n }\n else {\n newValues.set(id, value);\n lastValues.set(id, value);\n }\n }\n for (const id of removedValues.keys()) {\n lastValues.delete(id);\n }\n if (newValues.size || removedValues.size) {\n handler({ addedValues: [...newValues.values()], removedValues: [...removedValues.values()] });\n }\n });\n}\n/**\n * An autorun with a `dispose()` method on its `reader` which cancels the autorun.\n * It it safe to call `dispose()` synchronously.\n */\nfunction autorunSelfDisposable(fn, debugLocation = DebugLocation.ofCaller()) {\n let ar;\n let disposed = false;\n // eslint-disable-next-line prefer-const\n ar = autorun(reader => {\n fn({\n delayedStore: reader.delayedStore,\n store: reader.store,\n readObservable: reader.readObservable.bind(reader),\n dispose: () => {\n ar?.dispose();\n disposed = true;\n }\n });\n }, debugLocation);\n if (disposed) {\n ar.dispose();\n }\n return ar;\n}\n\nexport { autorun, autorunDelta, autorunHandleChanges, autorunIterableDelta, autorunOpts, autorunSelfDisposable, autorunWithStore, autorunWithStoreHandleChanges };\n//# sourceMappingURL=autorun.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { onUnexpectedError } from './commonFacade/deps.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * This function is used to indicate that the caller recovered from an error that indicates a bug.\n*/\nfunction handleBugIndicatingErrorRecovery(message) {\n const err = new Error('BugIndicatingErrorRecovery: ' + message);\n onUnexpectedError(err);\n console.error('recovered from an error that indicates a bug', err);\n}\n\nexport { handleBugIndicatingErrorRecovery };\n//# sourceMappingURL=base.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { handleBugIndicatingErrorRecovery } from './base.js';\nimport { getFunctionName } from './debugName.js';\nimport { getLogger } from './logging/logging.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Starts a transaction in which many observables can be changed at once.\n * {@link fn} should start with a JS Doc using `@description` to give the transaction a debug name.\n * Reaction run on demand or when the transaction ends.\n */\nfunction transaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n fn(tx);\n }\n finally {\n tx.finish();\n }\n}\nlet _globalTransaction = undefined;\nfunction globalTransaction(fn) {\n if (_globalTransaction) {\n fn(_globalTransaction);\n }\n else {\n const tx = new TransactionImpl(fn, undefined);\n _globalTransaction = tx;\n try {\n fn(tx);\n }\n finally {\n tx.finish(); // During finish, more actions might be added to the transaction.\n // Which is why we only clear the global transaction after finish.\n _globalTransaction = undefined;\n }\n }\n}\n/** @deprecated */\nasync function asyncTransaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n await fn(tx);\n }\n finally {\n tx.finish();\n }\n}\n/**\n * Allows to chain transactions.\n */\nfunction subtransaction(tx, fn, getDebugName) {\n if (!tx) {\n transaction(fn, getDebugName);\n }\n else {\n fn(tx);\n }\n}\nclass TransactionImpl {\n constructor(_fn, _getDebugName) {\n this._fn = _fn;\n this._getDebugName = _getDebugName;\n this._updatingObservers = [];\n getLogger()?.handleBeginTransaction(this);\n }\n getDebugName() {\n if (this._getDebugName) {\n return this._getDebugName();\n }\n return getFunctionName(this._fn);\n }\n updateObserver(observer, observable) {\n if (!this._updatingObservers) {\n // This happens when a transaction is used in a callback or async function.\n // If an async transaction is used, make sure the promise awaits all users of the transaction (e.g. no race).\n handleBugIndicatingErrorRecovery('Transaction already finished!');\n // Error recovery\n transaction(tx => {\n tx.updateObserver(observer, observable);\n });\n return;\n }\n // When this gets called while finish is active, they will still get considered\n this._updatingObservers.push({ observer, observable });\n observer.beginUpdate(observable);\n }\n finish() {\n const updatingObservers = this._updatingObservers;\n if (!updatingObservers) {\n handleBugIndicatingErrorRecovery('transaction.finish() has already been called!');\n return;\n }\n for (let i = 0; i < updatingObservers.length; i++) {\n const { observer, observable } = updatingObservers[i];\n observer.endUpdate(observable);\n }\n // Prevent anyone from updating observers from now on.\n this._updatingObservers = null;\n getLogger()?.handleEndTransaction(this);\n }\n debugGetUpdatingObservers() {\n return this._updatingObservers;\n }\n}\n\nexport { TransactionImpl, asyncTransaction, globalTransaction, subtransaction, transaction };\n//# sourceMappingURL=transaction.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { TransactionImpl } from '../transaction.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new ObservableValue(debugNameData, initialValue, strictEquals, debugLocation);\n}\nclass ObservableValue extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? 'ObservableValue';\n }\n constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._equalityComparator = _equalityComparator;\n this._value = initialValue;\n getLogger()?.handleObservableUpdated(this, { hadValue: false, newValue: initialValue, change: undefined, didChange: true, oldValue: undefined });\n }\n get() {\n return this._value;\n }\n set(value, tx, change) {\n if (change === undefined && this._equalityComparator(this._value, value)) {\n return;\n }\n let _tx;\n if (!tx) {\n tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);\n }\n try {\n const oldValue = this._value;\n this._setValue(value);\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue: value, change, didChange: true, hadValue: true });\n for (const observer of this._observers) {\n tx.updateObserver(observer, this);\n observer.handleChange(this, change);\n }\n }\n finally {\n if (_tx) {\n _tx.finish();\n }\n }\n }\n toString() {\n return `${this.debugName}: ${this._value}`;\n }\n _setValue(newValue) {\n this._value = newValue;\n }\n debugGetState() {\n return {\n value: this._value,\n };\n }\n debugSetValue(value) {\n this._value = value;\n }\n}\n/**\n * A disposable observable. When disposed, its value is also disposed.\n * When a new value is set, the previous value is disposed.\n */\nfunction disposableObservableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new DisposableObservableValue(debugNameData, initialValue, strictEquals, debugLocation);\n}\nclass DisposableObservableValue extends ObservableValue {\n _setValue(newValue) {\n if (this._value === newValue) {\n return;\n }\n if (this._value) {\n this._value.dispose();\n }\n this._value = newValue;\n }\n dispose() {\n this._value?.dispose();\n }\n}\n\nexport { DisposableObservableValue, ObservableValue, disposableObservableValue, observableValue };\n//# sourceMappingURL=observableValue.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { subtransaction } from '../transaction.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { getLogger } from '../logging/logging.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableFromEvent(...args) {\n let owner;\n let event;\n let getValue;\n let debugLocation;\n if (args.length === 2) {\n [event, getValue] = args;\n }\n else {\n [owner, event, getValue, debugLocation] = args;\n }\n return new FromEventObservable(new DebugNameData(owner, undefined, getValue), event, getValue, () => FromEventObservable.globalTransaction, strictEquals, debugLocation ?? DebugLocation.ofCaller());\n}\nfunction observableFromEventOpts(options, event, getValue, debugLocation = DebugLocation.ofCaller()) {\n return new FromEventObservable(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? getValue), event, getValue, () => FromEventObservable.globalTransaction, options.equalsFn ?? strictEquals, debugLocation);\n}\nclass FromEventObservable extends BaseObservable {\n constructor(_debugNameData, event, _getValue, _getTransaction, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this.event = event;\n this._getValue = _getValue;\n this._getTransaction = _getTransaction;\n this._equalityComparator = _equalityComparator;\n this._hasValue = false;\n this.handleEvent = (args) => {\n const newValue = this._getValue(args);\n const oldValue = this._value;\n const didChange = !this._hasValue || !(this._equalityComparator(oldValue, newValue));\n let didRunTransaction = false;\n if (didChange) {\n this._value = newValue;\n if (this._hasValue) {\n didRunTransaction = true;\n subtransaction(this._getTransaction(), (tx) => {\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });\n for (const o of this._observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => {\n const name = this.getDebugName();\n return 'Event fired' + (name ? `: ${name}` : '');\n });\n }\n this._hasValue = true;\n }\n if (!didRunTransaction) {\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });\n }\n };\n }\n getDebugName() {\n return this._debugNameData.getDebugName(this);\n }\n get debugName() {\n const name = this.getDebugName();\n return 'From Event' + (name ? `: ${name}` : '');\n }\n onFirstObserverAdded() {\n this._subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this._subscription.dispose();\n this._subscription = undefined;\n this._hasValue = false;\n this._value = undefined;\n }\n get() {\n if (this._subscription) {\n if (!this._hasValue) {\n this.handleEvent(undefined);\n }\n return this._value;\n }\n else {\n // no cache, as there are no subscribers to keep it updated\n const value = this._getValue(undefined);\n return value;\n }\n }\n debugSetValue(value) {\n this._value = value;\n }\n debugGetState() {\n return { value: this._value, hasValue: this._hasValue };\n }\n}\n(function (observableFromEvent) {\n observableFromEvent.Observer = FromEventObservable;\n function batchEventsGlobally(tx, fn) {\n let didSet = false;\n if (FromEventObservable.globalTransaction === undefined) {\n FromEventObservable.globalTransaction = tx;\n didSet = true;\n }\n try {\n fn();\n }\n finally {\n if (didSet) {\n FromEventObservable.globalTransaction = undefined;\n }\n }\n }\n observableFromEvent.batchEventsGlobally = batchEventsGlobally;\n})(observableFromEvent || (observableFromEvent = {}));\n\nexport { FromEventObservable, observableFromEvent, observableFromEventOpts };\n//# sourceMappingURL=observableFromEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { autorun } from '../reactions/autorun.js';\nimport { transaction } from '../transaction.js';\nimport { observableValue } from '../observables/observableValue.js';\nimport { toDisposable } from '../commonFacade/deps.js';\nimport { derivedOpts, derived } from '../observables/derived.js';\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { observableSignal } from '../observables/observableSignal.js';\nimport { _setKeepObserved, _setRecomputeInitiallyAndOnChange } from '../observables/baseObservable.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableFromPromise(promise) {\n const observable = observableValue('promiseValue', {});\n promise.then((value) => {\n observable.set({ value }, undefined);\n });\n return observable;\n}\nfunction signalFromObservable(owner, observable) {\n return derivedOpts({\n owner,\n equalsFn: () => false,\n }, reader => {\n observable.read(reader);\n });\n}\n/**\n * @deprecated Use `debouncedObservable` instead.\n */\nfunction debouncedObservableDeprecated(observable, debounceMs, disposableStore) {\n const debouncedObservable = observableValue('debounced', undefined);\n let timeout = undefined;\n disposableStore.add(autorun(reader => {\n /** @description debounce */\n const value = observable.read(reader);\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n transaction(tx => {\n debouncedObservable.set(value, tx);\n });\n }, debounceMs);\n }));\n return debouncedObservable;\n}\n/**\n * Creates an observable that debounces the input observable.\n */\nfunction debouncedObservable(observable, debounceMs) {\n let hasValue = false;\n let lastValue;\n let timeout = undefined;\n return observableFromEvent(cb => {\n const d = autorun(reader => {\n const value = observable.read(reader);\n if (!hasValue) {\n hasValue = true;\n lastValue = value;\n }\n else {\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n lastValue = value;\n cb();\n }, debounceMs);\n }\n });\n return {\n dispose() {\n d.dispose();\n hasValue = false;\n lastValue = undefined;\n },\n };\n }, () => {\n if (hasValue) {\n return lastValue;\n }\n else {\n return observable.get();\n }\n });\n}\nfunction wasEventTriggeredRecently(event, timeoutMs, disposableStore) {\n const observable = observableValue('triggeredRecently', false);\n let timeout = undefined;\n disposableStore.add(event(() => {\n observable.set(true, undefined);\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n observable.set(false, undefined);\n }, timeoutMs);\n }));\n return observable;\n}\n/**\n * This makes sure the observable is being observed and keeps its cache alive.\n */\nfunction keepObserved(observable) {\n const o = new KeepAliveObserver(false, undefined);\n observable.addObserver(o);\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setKeepObserved(keepObserved);\n/**\n * This converts the given observable into an autorun.\n */\nfunction recomputeInitiallyAndOnChange(observable, handleValue) {\n const o = new KeepAliveObserver(true, handleValue);\n observable.addObserver(o);\n try {\n o.beginUpdate(observable);\n }\n finally {\n o.endUpdate(observable);\n }\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);\nclass KeepAliveObserver {\n constructor(_forceRecompute, _handleValue) {\n this._forceRecompute = _forceRecompute;\n this._handleValue = _handleValue;\n this._counter = 0;\n }\n beginUpdate(observable) {\n this._counter++;\n }\n endUpdate(observable) {\n if (this._counter === 1 && this._forceRecompute) {\n if (this._handleValue) {\n this._handleValue(observable.get());\n }\n else {\n observable.reportChanges();\n }\n }\n this._counter--;\n }\n handlePossibleChange(observable) {\n // NO OP\n }\n handleChange(observable, change) {\n // NO OP\n }\n}\nfunction derivedObservableWithCache(owner, computeFn) {\n let lastValue = undefined;\n const observable = derivedOpts({ owner, debugReferenceFn: computeFn }, reader => {\n lastValue = computeFn(reader, lastValue);\n return lastValue;\n });\n return observable;\n}\nfunction derivedObservableWithWritableCache(owner, computeFn) {\n let lastValue = undefined;\n const onChange = observableSignal('derivedObservableWithWritableCache');\n const observable = derived(owner, reader => {\n onChange.read(reader);\n lastValue = computeFn(reader, lastValue);\n return lastValue;\n });\n return Object.assign(observable, {\n clearCache: (tx) => {\n lastValue = undefined;\n onChange.trigger(tx);\n },\n setCache: (newValue, tx) => {\n lastValue = newValue;\n onChange.trigger(tx);\n }\n });\n}\n/**\n * When the items array changes, referential equal items are not mapped again.\n */\nfunction mapObservableArrayCached(owner, items, map, keySelector) {\n let m = new ArrayMap(map, keySelector);\n const self = derivedOpts({\n debugReferenceFn: map,\n owner,\n onLastObserverRemoved: () => {\n m.dispose();\n m = new ArrayMap(map);\n }\n }, (reader) => {\n m.setItems(items.read(reader));\n return m.getItems();\n });\n return self;\n}\nclass ArrayMap {\n constructor(_map, _keySelector) {\n this._map = _map;\n this._keySelector = _keySelector;\n this._cache = new Map();\n this._items = [];\n }\n dispose() {\n this._cache.forEach(entry => entry.store.dispose());\n this._cache.clear();\n }\n setItems(items) {\n const newItems = [];\n const itemsToRemove = new Set(this._cache.keys());\n for (const item of items) {\n const key = this._keySelector ? this._keySelector(item) : item;\n let entry = this._cache.get(key);\n if (!entry) {\n const store = new DisposableStore();\n const out = this._map(item, store);\n entry = { out, store };\n this._cache.set(key, entry);\n }\n else {\n itemsToRemove.delete(key);\n }\n newItems.push(entry.out);\n }\n for (const item of itemsToRemove) {\n const entry = this._cache.get(item);\n entry.store.dispose();\n this._cache.delete(item);\n }\n this._items = newItems;\n }\n getItems() {\n return this._items;\n }\n}\n\nexport { KeepAliveObserver, debouncedObservable, debouncedObservableDeprecated, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, mapObservableArrayCached, observableFromPromise, recomputeInitiallyAndOnChange, signalFromObservable, wasEventTriggeredRecently };\n//# sourceMappingURL=utils.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { addLogger } from './logging.js';\nimport { getClassName } from '../debugName.js';\nimport { Derived } from '../observables/derivedImpl.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nlet consoleObservableLogger;\nfunction logObservableToConsole(obs) {\n if (!consoleObservableLogger) {\n consoleObservableLogger = new ConsoleObservableLogger();\n addLogger(consoleObservableLogger);\n }\n consoleObservableLogger.addFilteredObj(obs);\n}\nclass ConsoleObservableLogger {\n constructor() {\n this.indentation = 0;\n this.changedObservablesSets = new WeakMap();\n }\n addFilteredObj(obj) {\n if (!this._filteredObjects) {\n this._filteredObjects = new Set();\n }\n this._filteredObjects.add(obj);\n }\n _isIncluded(obj) {\n return this._filteredObjects?.has(obj) ?? true;\n }\n textToConsoleArgs(text) {\n return consoleTextToArgs([\n normalText(repeat('| ', this.indentation)),\n text,\n ]);\n }\n formatInfo(info) {\n if (!info.hadValue) {\n return [\n normalText(` `),\n styled(formatValue(info.newValue, 60), {\n color: 'green',\n }),\n normalText(` (initial)`),\n ];\n }\n return info.didChange\n ? [\n normalText(` `),\n styled(formatValue(info.oldValue, 70), {\n color: 'red',\n strikeThrough: true,\n }),\n normalText(` `),\n styled(formatValue(info.newValue, 60), {\n color: 'green',\n }),\n ]\n : [normalText(` (unchanged)`)];\n }\n handleObservableCreated(observable) {\n if (observable instanceof Derived) {\n const derived = observable;\n this.changedObservablesSets.set(derived, new Set());\n }\n }\n handleOnListenerCountChanged(observable, newCount) {\n }\n handleObservableUpdated(observable, info) {\n if (!this._isIncluded(observable)) {\n return;\n }\n if (observable instanceof Derived) {\n this._handleDerivedRecomputed(observable, info);\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('observable value changed'),\n styled(observable.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n ]));\n }\n formatChanges(changes) {\n if (changes.size === 0) {\n return undefined;\n }\n return styled(' (changed deps: ' +\n [...changes].map((o) => o.debugName).join(', ') +\n ')', { color: 'gray' });\n }\n handleDerivedDependencyChanged(derived, observable, change) {\n if (!this._isIncluded(derived)) {\n return;\n }\n this.changedObservablesSets.get(derived)?.add(observable);\n }\n _handleDerivedRecomputed(derived, info) {\n if (!this._isIncluded(derived)) {\n return;\n }\n const changedObservables = this.changedObservablesSets.get(derived);\n if (!changedObservables) {\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('derived recomputed'),\n styled(derived.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n this.formatChanges(changedObservables),\n { data: [{ fn: derived._debugNameData.referenceFn ?? derived._computeFn }] }\n ]));\n changedObservables.clear();\n }\n handleDerivedCleared(derived) {\n if (!this._isIncluded(derived)) {\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('derived cleared'),\n styled(derived.debugName, { color: 'BlueViolet' }),\n ]));\n }\n handleFromEventObservableTriggered(observable, info) {\n if (!this._isIncluded(observable)) {\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('observable from event triggered'),\n styled(observable.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n { data: [{ fn: observable._getValue }] }\n ]));\n }\n handleAutorunCreated(autorun) {\n if (!this._isIncluded(autorun)) {\n return;\n }\n this.changedObservablesSets.set(autorun, new Set());\n }\n handleAutorunDisposed(autorun) {\n }\n handleAutorunDependencyChanged(autorun, observable, change) {\n if (!this._isIncluded(autorun)) {\n return;\n }\n this.changedObservablesSets.get(autorun).add(observable);\n }\n handleAutorunStarted(autorun) {\n const changedObservables = this.changedObservablesSets.get(autorun);\n if (!changedObservables) {\n return;\n }\n if (this._isIncluded(autorun)) {\n console.log(...this.textToConsoleArgs([\n formatKind('autorun'),\n styled(autorun.debugName, { color: 'BlueViolet' }),\n this.formatChanges(changedObservables),\n { data: [{ fn: autorun._debugNameData.referenceFn ?? autorun._runFn }] }\n ]));\n }\n changedObservables.clear();\n this.indentation++;\n }\n handleAutorunFinished(autorun) {\n this.indentation--;\n }\n handleBeginTransaction(transaction) {\n let transactionName = transaction.getDebugName();\n if (transactionName === undefined) {\n transactionName = '';\n }\n if (this._isIncluded(transaction)) {\n console.log(...this.textToConsoleArgs([\n formatKind('transaction'),\n styled(transactionName, { color: 'BlueViolet' }),\n { data: [{ fn: transaction._fn }] }\n ]));\n }\n this.indentation++;\n }\n handleEndTransaction() {\n this.indentation--;\n }\n}\nfunction consoleTextToArgs(text) {\n const styles = new Array();\n const data = [];\n let firstArg = '';\n function process(t) {\n if ('length' in t) {\n for (const item of t) {\n if (item) {\n process(item);\n }\n }\n }\n else if ('text' in t) {\n firstArg += `%c${t.text}`;\n styles.push(t.style);\n if (t.data) {\n data.push(...t.data);\n }\n }\n else if ('data' in t) {\n data.push(...t.data);\n }\n }\n process(text);\n const result = [firstArg, ...styles];\n result.push(...data);\n return result;\n}\nfunction normalText(text) {\n return styled(text, { color: 'black' });\n}\nfunction formatKind(kind) {\n return styled(padStr(`${kind}: `, 10), { color: 'black', bold: true });\n}\nfunction styled(text, options = {\n color: 'black',\n}) {\n function objToCss(styleObj) {\n return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => {\n return `${styleString}${propName}:${propValue};`;\n }, '');\n }\n const style = {\n color: options.color,\n };\n if (options.strikeThrough) {\n style['text-decoration'] = 'line-through';\n }\n if (options.bold) {\n style['font-weight'] = 'bold';\n }\n return {\n text,\n style: objToCss(style),\n };\n}\nfunction formatValue(value, availableLen) {\n try {\n return formatValueUnsafe(value, availableLen);\n }\n catch {\n // Value could not be formatted (e.g., a Proxy that throws on coercion)\n return '[[???]]';\n }\n}\nfunction formatValueUnsafe(value, availableLen) {\n switch (typeof value) {\n case 'number':\n return '' + value;\n case 'string':\n if (value.length + 2 <= availableLen) {\n return `\"${value}\"`;\n }\n return `\"${value.substr(0, availableLen - 7)}\"+...`;\n case 'boolean':\n return value ? 'true' : 'false';\n case 'undefined':\n return 'undefined';\n case 'object':\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return formatArray(value, availableLen);\n }\n return formatObject(value, availableLen);\n case 'symbol':\n return value.toString();\n case 'function':\n return `[[Function${value.name ? ' ' + value.name : ''}]]`;\n default:\n return '' + value;\n }\n}\nfunction formatArray(value, availableLen) {\n let result = '[ ';\n let first = true;\n for (const val of value) {\n if (!first) {\n result += ', ';\n }\n if (result.length - 5 > availableLen) {\n result += '...';\n break;\n }\n first = false;\n result += `${formatValue(val, availableLen - result.length)}`;\n }\n result += ' ]';\n return result;\n}\nfunction formatObject(value, availableLen) {\n // Avoid drilling into Proxies - wrap operations that could trigger traps\n try {\n if (typeof value.toString === 'function' && value.toString !== Object.prototype.toString) {\n const val = value.toString();\n if (val.length <= availableLen) {\n return val;\n }\n return val.substring(0, availableLen - 3) + '...';\n }\n }\n catch {\n // toString triggered a Proxy trap or threw - bail out\n return '[[Object]]';\n }\n const className = getClassName(value);\n let result = className ? className + '(' : '{ ';\n let first = true;\n let entries;\n try {\n entries = Object.entries(value);\n }\n catch {\n // Object.entries triggered a Proxy trap - bail out\n return className ? `${className}(...)` : '[[Object]]';\n }\n for (const [key, val] of entries) {\n if (!first) {\n result += ', ';\n }\n if (result.length - 5 > availableLen) {\n result += '...';\n break;\n }\n first = false;\n result += `${key}: ${formatValue(val, availableLen - result.length)}`;\n }\n result += className ? ')' : ' }';\n return result;\n}\nfunction repeat(str, count) {\n let result = '';\n for (let i = 1; i <= count; i++) {\n result += str;\n }\n return result;\n}\nfunction padStr(str, length) {\n while (str.length < length) {\n str += ' ';\n }\n return str;\n}\n\nexport { ConsoleObservableLogger, formatValue, logObservableToConsole };\n//# sourceMappingURL=consoleObservableLogger.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { Derived } from '../observables/derivedImpl.js';\nimport { FromEventObservable } from '../observables/observableFromEvent.js';\nimport { ObservableValue } from '../observables/observableValue.js';\nimport { AutorunObserver } from '../reactions/autorunImpl.js';\nimport { formatValue } from './consoleObservableLogger.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction debugGetDependencyGraph(obs, options) {\n const debugNamePostProcessor = options?.debugNamePostProcessor ?? ((str) => str);\n const info = Info.from(obs, debugNamePostProcessor);\n if (!info) {\n return '';\n }\n const alreadyListed = new Set();\n return formatObservableInfo(info, 0, alreadyListed).trim();\n}\nfunction formatObservableInfo(info, indentLevel, alreadyListed) {\n const indent = '\\t\\t'.repeat(indentLevel);\n const lines = [];\n const isAlreadyListed = alreadyListed.has(info.sourceObj);\n if (isAlreadyListed) {\n lines.push(`${indent}* ${info.type} ${info.name} (already listed)`);\n return lines.join('\\n');\n }\n alreadyListed.add(info.sourceObj);\n lines.push(`${indent}* ${info.type} ${info.name}:`);\n lines.push(`${indent} value: ${formatValue(info.value, 50)}`);\n lines.push(`${indent} state: ${info.state}`);\n if (info.dependencies.length > 0) {\n lines.push(`${indent} dependencies:`);\n for (const dep of info.dependencies) {\n lines.push(formatObservableInfo(dep, indentLevel + 1, alreadyListed));\n }\n }\n return lines.join('\\n');\n}\nclass Info {\n static from(obs, debugNamePostProcessor) {\n if (obs instanceof AutorunObserver) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'autorun', undefined, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));\n }\n else if (obs instanceof Derived) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'derived', state.value, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));\n }\n else if (obs instanceof ObservableValue) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'observableValue', state.value, 'upToDate', []);\n }\n else if (obs instanceof FromEventObservable) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'fromEvent', state.value, state.hasValue ? 'upToDate' : 'initial', []);\n }\n return undefined;\n }\n static unknown(obs) {\n return new Info(obs, '(unknown)', 'unknown', undefined, 'unknown', []);\n }\n constructor(sourceObj, name, type, value, state, dependencies) {\n this.sourceObj = sourceObj;\n this.name = name;\n this.type = type;\n this.value = value;\n this.state = state;\n this.dependencies = dependencies;\n }\n}\n\nexport { debugGetDependencyGraph };\n//# sourceMappingURL=debugGetDependencyGraph.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { setLogObservableFn } from './logging/logging.js';\nimport { _setDebugGetDependencyGraph } from './observables/baseObservable.js';\nexport { DebugLocation } from './debugLocation.js';\nexport { derived, derivedDisposable, derivedHandleChanges, derivedOpts, derivedWithSetter, derivedWithStore } from './observables/derived.js';\nexport { debouncedObservable, debouncedObservableDeprecated, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, mapObservableArrayCached, observableFromPromise, recomputeInitiallyAndOnChange, signalFromObservable, wasEventTriggeredRecently } from './utils/utils.js';\nexport { observableFromEvent, observableFromEventOpts } from './observables/observableFromEvent.js';\nimport { logObservableToConsole } from './logging/consoleObservableLogger.js';\nimport { debugGetDependencyGraph } from './logging/debugGetDependencyGraph.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n// This is a facade for the observable implementation. Only import from here!\n_setDebugGetDependencyGraph(debugGetDependencyGraph);\nsetLogObservableFn(logObservableToConsole);\n//# sourceMappingURL=index.js.map\n","import { observableValue, derived, type IObservable, type IReader } from '@vscode/observables';\nimport type { FixtureExport } from './fixtureApi.js';\nimport { type ComponentDefinition } from './fixtureApiConsumer.js';\nimport { createFixtureTree, findNodeByPath, type FixtureNode } from './FixtureNode.js';\n\nexport class FixtureRegistry {\n private readonly _fixtures = observableValue<Map<string, FixtureExport>>(this, new Map());\n readonly loading = observableValue<boolean>(this, false);\n readonly error = observableValue<string | undefined>(this, undefined);\n\n readonly root: IObservable<FixtureNode> = derived(this, (reader) => {\n const fixtures = this._fixtures.read(reader);\n return createFixtureTree(fixtures);\n });\n\n register(path: string, fixtureExport: FixtureExport): void {\n const fixtures = new Map(this._fixtures.get());\n fixtures.set(path, fixtureExport);\n this._fixtures.set(fixtures, undefined);\n }\n\n unregister(path: string): void {\n const fixtures = new Map(this._fixtures.get());\n if (fixtures.delete(path)) {\n this._fixtures.set(fixtures, undefined);\n }\n }\n\n clear(): void {\n this._fixtures.set(new Map(), undefined);\n }\n\n getNode(reader: IReader, path: string[]): FixtureNode | undefined {\n const root = this.root.read(reader);\n return findNodeByPath(root, path);\n }\n\n getComponentByPath(path: string[]): ComponentDefinition | undefined {\n const fixtures = this._fixtures.get();\n const tree = createFixtureTree(fixtures);\n const node = findNodeByPath(tree, path);\n return node?.component;\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ManualChangesHandler {\n constructor(_run) {\n this._run = _run;\n this._changes = [];\n this._map = new Map();\n this._updateCounter = 0;\n }\n addDependency(observable, data) {\n this._map.set(observable, data);\n observable.addObserver(this);\n return {\n dispose: () => {\n this._map.delete(observable);\n observable.removeObserver(this);\n }\n };\n }\n beginUpdate(observable) {\n this._updateCounter++;\n this._changes.push(this._map.get(observable));\n }\n endUpdate(_observable) {\n this._updateCounter--;\n if (this._updateCounter === 0) {\n if (this._changes.length > 0) {\n const c = this._changes;\n this._changes = [];\n this._run(c);\n }\n }\n }\n handlePossibleChange(observable) {\n this._changes.push(this._map.get(observable));\n }\n handleChange(_observable, _change) {\n //this._changes.push(this._map.get(observable)!);\n }\n}\n\nexport { ManualChangesHandler };\n//# sourceMappingURL=ManualChangesHandler.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { derived } from '@vscode/observables';\n\n/**\n * Takes a value of type `T` and makes it available as `IObservable<T>`.\n * When it changes, the component will not re-render.\n */\nfunction prop() {\n return PropertyTransformerFactory.instance;\n}\n/**\n * Takes a value of type `T` and makes it available as `T`.\n * When it changes, the component will re-render.\n */\nfunction propConst() {\n return PropertyConstTransformerFactory.instance;\n}\n/**\n * Takes a value of type `T` or `IObservable<T>` and makes it available as `IObservable<T>`.\n * When it changes, the component will not re-render.\n */\nfunction propObs() {\n return PropertyObsTransformerFactory.instance;\n}\nprop.const = propConst;\nprop.obs = propObs;\nclass PropertyTransformerFactory {\n create(readableProp) {\n const d = derived(reader => readableProp(reader));\n return { read: (_reader) => d };\n }\n}\nPropertyTransformerFactory.instance = new PropertyTransformerFactory();\nclass PropertyConstTransformerFactory {\n create(readableProp) {\n const d = derived(reader => readableProp(reader));\n return { read: (reader) => d.read(reader) };\n }\n}\nPropertyConstTransformerFactory.instance = new PropertyConstTransformerFactory();\nclass PropertyObsTransformerFactory {\n create(readableProp) {\n const d = derived(reader => {\n const v = readableProp(reader);\n if (isObservable(v)) {\n return v.read(reader);\n }\n else {\n return v;\n }\n });\n return { read: (_reader) => d };\n }\n}\nPropertyObsTransformerFactory.instance = new PropertyObsTransformerFactory();\nfunction isObservable(obs) {\n return typeof obs === \"object\" && obs !== null && \"read\" in obs;\n}\n\nexport { prop };\n//# sourceMappingURL=IPropertyTransformer.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Maps over an object's values, returning a new object with the same keys\n * but transformed values.\n */\nfunction mapObject(obj, fn) {\n return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value, key)]));\n}\n\nexport { mapObject };\n//# sourceMappingURL=utils.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DisposableStore } from '@vscode/observables';\nimport { createContext } from 'react';\n\n// Symbol to store the context on the ViewModel class\nconst ViewModelContextSymbol = Symbol('ViewModelContext');\nclass BaseViewModel {\n constructor(props) {\n this._store = new DisposableStore();\n this.props = props;\n }\n dispose() {\n this._store.dispose();\n }\n}\n/** Get or create the context for a ViewModel class */\nfunction getOrCreateViewModelContext(ctor) {\n if (!ctor[ViewModelContextSymbol]) {\n ctor[ViewModelContextSymbol] =\n createContext(undefined);\n }\n return ctor[ViewModelContextSymbol];\n}\nfunction ViewModel(props = {}) {\n var _a;\n return _a = class extends BaseViewModel {\n },\n _a._props = props,\n _a;\n}\n\nexport { BaseViewModel, ViewModel, ViewModelContextSymbol, getOrCreateViewModelContext };\n//# sourceMappingURL=viewModel.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { useReducer, useState, useContext, useEffect } from 'react';\nimport { observableValue, derived } from '@vscode/observables';\nimport { ManualChangesHandler } from './ManualChangesHandler.js';\nimport { unstable_batchedUpdates } from 'react-dom';\n\nlet renderingCount = 0;\nconst batchedUpdater = new ManualChangesHandler(potentialChanges => {\n for (const change of potentialChanges) {\n change.rendered = false;\n }\n if (renderingCount > 0) {\n const rendering = potentialChanges.find(c => c.isRendering);\n rendering.itemsToRender = potentialChanges;\n }\n else {\n unstable_batchedUpdates(() => {\n for (const change of potentialChanges) {\n if (!change.rendered) {\n change.forceUpdate();\n }\n }\n });\n }\n});\nlet viewIdx = 0;\nclass ViewImpl {\n constructor(debugName, renderFactory) {\n this.debugName = debugName;\n this.renderFactory = renderFactory;\n this._obsProps = undefined;\n this.forceUpdate = undefined;\n this._render = undefined;\n this._disposable = undefined;\n this.contextValues = new Map();\n this.cleanupEffect = () => {\n return () => {\n this._disposable?.dispose();\n };\n };\n this.itemsToRender = [];\n this.handleAfterRender = () => {\n unstable_batchedUpdates(() => {\n for (const change of this.itemsToRender) {\n if (!change.rendered) {\n change.forceUpdate();\n }\n }\n });\n this.itemsToRender = [];\n };\n this.rendering = undefined;\n this.isRendering = false;\n this.rendered = false;\n }\n toString() {\n return this.debugName;\n }\n updateProps(props) {\n if (!this._obsProps) {\n this._obsProps = observableValue(this, props);\n this._render = this.renderFactory(this._obsProps, () => this.contextValues);\n this.rendering = derived(this, this._render);\n this._disposable = batchedUpdater.addDependency(this.rendering, this);\n }\n else {\n this._obsProps.set(props, undefined);\n }\n }\n}\nfunction obsView(componentName, render, contexts) {\n const plusOne = (x) => x + 1;\n const createVM = () => new ViewImpl(componentName + (++viewIdx), render);\n const fn = function (props) {\n const forceUpdate = useReducer(plusOne, 0)[1];\n const state = useState(createVM)[0];\n // Read and update context values each render\n for (const ctx of contexts ?? []) {\n state.contextValues.set(ctx, useContext(ctx)); // eslint-disable-line react-hooks/rules-of-hooks\n }\n useEffect(state.cleanupEffect, []);\n useEffect(state.handleAfterRender);\n if (state.isRendering) {\n throw new Error(\"Component is already rendering\");\n }\n state.isRendering = true;\n renderingCount++;\n try {\n state.forceUpdate = forceUpdate;\n state.updateProps(props);\n const result = state.rendering.get();\n state.rendered = true;\n return result;\n }\n finally {\n state.isRendering = false;\n renderingCount--;\n }\n };\n fn.displayName = componentName;\n return fn;\n}\nconst ObsView = obsView('ObsView', (props) => reader => props.read(reader).children(reader));\n\nexport { ObsView, obsView };\n//# sourceMappingURL=obsView.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { obsView } from './obsView.js';\nimport { mapObject } from './utils.js';\n\n/**\n * Creates a React component with typed observable props.\n * Props are transformed according to their IPropertyTransformerFactory.\n */\nfunction view(props, render) {\n return obsView('view', (p) => {\n const readableProps = mapObject(props, (value, key) => {\n return value.create(reader => p.read(reader)[key], undefined);\n });\n return reader => {\n const propValues = mapObject(readableProps, (value) => {\n return value.read(reader);\n });\n return render(reader, propValues);\n };\n });\n}\n\nexport { view };\n//# sourceMappingURL=view.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { derivedDisposable } from '@vscode/observables';\nimport { obsView } from './obsView.js';\nimport { mapObject } from './utils.js';\nimport { getOrCreateViewModelContext } from './viewModel.js';\n\n/** Collect unique _requiredContext from transformers */\nfunction collectRequiredContexts(propsDesc) {\n const contexts = [];\n for (const t of Object.values(propsDesc)) {\n const ctx = t._requiredContext;\n if (ctx && !contexts.includes(ctx))\n contexts.push(ctx);\n }\n return contexts;\n}\nfunction viewWithModel(viewModelCtor, propsOrRender, maybeRender) {\n const props = typeof propsOrRender === 'function' ? {} : propsOrRender;\n const render = typeof propsOrRender === 'function' ? propsOrRender : maybeRender;\n const modelPropsDesc = '_props' in viewModelCtor ? viewModelCtor._props : {};\n const requiredContexts = collectRequiredContexts({ ...modelPropsDesc, ...props });\n // Always create the context so ProvideViewModel can work\n const viewModelContext = getOrCreateViewModelContext(viewModelCtor);\n const allContexts = [...requiredContexts, viewModelContext];\n return obsView('viewWithModel', (p, getContextValues) => {\n const contextValues = getContextValues();\n const providedModel = contextValues.get(viewModelContext);\n const readableModelProps = '_props' in viewModelCtor\n ? mapObject(viewModelCtor._props, (v, k) => v.create((r) => p.read(r)[k], contextValues.get(v._requiredContext)))\n : {};\n const model = providedModel\n ? { read: () => providedModel, dispose: () => { } }\n : derivedDisposable(reader => {\n const modelProps = mapObject(readableModelProps, (v) => v.read(reader));\n return new viewModelCtor(modelProps);\n });\n const readableProps = mapObject(props, (v, k) => v.create((r) => p.read(r)[k], contextValues.get(v._requiredContext)));\n return (reader) => {\n const m = model.read(reader);\n const propValues = mapObject(readableProps, (v) => v.read(reader));\n return render(reader, m, propValues);\n };\n }, allContexts.length > 0 ? allContexts : undefined);\n}\n\nexport { viewWithModel };\n//# sourceMappingURL=viewWithModel.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { jsx } from 'react/jsx-runtime';\nimport { prop } from './IPropertyTransformer.js';\nimport { view } from './view.js';\n\n/**\n * A component that renders an observable ReactNode value.\n * Re-renders when the observable changes.\n * Usage: <Value value={myObservable} />\n */\nconst Value = view({ value: prop.obs() }, (reader, props) => {\n return props.value.read(reader);\n});\n/**\n * Helper function to render an observable as inline JSX.\n * Usage: {val(myObservable)}\n */\nfunction val(v) {\n return jsx(Value, { value: v });\n}\n\nexport { Value, val };\n//# sourceMappingURL=Value.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { jsx } from 'react/jsx-runtime';\nimport { createContext, useContext } from 'react';\nimport { derived } from '@vscode/observables';\n\nfunction createServiceKey(nameOrCtor) {\n const name = typeof nameOrCtor === 'string' ? nameOrCtor : nameOrCtor.name;\n return { _brand: undefined, id: Symbol(name), name };\n}\n// =============================================================================\n// DI Container\n// =============================================================================\nclass DIContainer {\n constructor(parent = null) {\n this._services = new Map();\n this._parent = parent;\n }\n register(key, service) {\n this._services.set(key.id, service);\n return this;\n }\n get(key) {\n const service = this._services.get(key.id);\n if (service !== undefined)\n return service;\n if (this._parent)\n return this._parent.get(key);\n throw new Error(`Service \"${key.name}\" not registered`);\n }\n has(key) {\n return this._services.has(key.id) || (this._parent?.has(key) ?? false);\n }\n createChild() {\n return new DIContainer(this);\n }\n}\n// =============================================================================\n// React Context\n// =============================================================================\nconst DIContext = createContext(null);\nfunction DIProvider({ container, children }) {\n return jsx(DIContext.Provider, { value: container, children: children });\n}\nfunction useDIContainer() {\n const container = useContext(DIContext);\n if (!container)\n throw new Error(\"DIProvider not found\");\n return container;\n}\n// =============================================================================\n// inject() - Property Transformer for DI\n// =============================================================================\nclass InjectTransformerFactory {\n constructor(serviceKey) {\n this.serviceKey = serviceKey;\n this._requiredContext = DIContext;\n }\n create(readable, contextValue) {\n const container = contextValue;\n let cachedService;\n return derived(reader => {\n // Check if an explicit value was provided as a prop\n const explicitValue = readable(reader);\n if (explicitValue !== undefined) {\n return explicitValue;\n }\n // Otherwise, use DI container (cached)\n if (cachedService === undefined) {\n if (!container)\n throw new Error(`inject(${this.serviceKey.name}): DIProvider not found`);\n cachedService = container.get(this.serviceKey);\n }\n return cachedService;\n });\n }\n}\n/** Inject a service from DIContainer into a ViewModel property */\nfunction inject(key) {\n return new InjectTransformerFactory(key);\n}\n\nexport { DIContainer, DIContext, DIProvider, createServiceKey, inject, useDIContainer };\n//# sourceMappingURL=di.js.map\n","import type { FixtureNode, ComponentDefinition } from '../core/index.js';\nimport type { FixturePath } from '../core/FixturePath.js';\n\n/**\n * Explorer's tree node structure, derived from FixtureNode.\n * This is the explorer's own representation of the fixture tree.\n */\nexport interface ExplorerTreeNode {\n readonly id: FixturePath;\n readonly name: string;\n readonly type: 'folder' | 'variants' | 'component';\n readonly children?: readonly ExplorerTreeNode[];\n readonly component?: ComponentDefinition;\n readonly labels: readonly string[];\n}\n\n/**\n * Converts a FixtureNode tree to ExplorerTreeNode tree.\n * This allows the explorer to have its own tree structure.\n */\nexport function toExplorerTree(node: FixtureNode): ExplorerTreeNode {\n return {\n id: node.id,\n name: node.name,\n type: node.type,\n children: node.children?.map(toExplorerTree),\n component: node.component,\n labels: node.labels,\n };\n}\n","import type { ExplorerTreeNode } from './types.js';\n\nfunction nodeMatches(node: ExplorerTreeNode, lowerQuery: string): boolean {\n\tif (node.name.toLowerCase().includes(lowerQuery)) return true;\n\tfor (const label of node.labels) {\n\t\tif (label.toLowerCase().includes(lowerQuery)) return true;\n\t}\n\treturn false;\n}\n\nexport function filterTree(root: ExplorerTreeNode, query: string | undefined): ExplorerTreeNode | undefined {\n\tif (!query) return root;\n\tconst lowerQuery = query.toLowerCase();\n\treturn filterNode(root, lowerQuery);\n}\n\nfunction filterNode(node: ExplorerTreeNode, lowerQuery: string): ExplorerTreeNode | undefined {\n\tconst selfMatches = nodeMatches(node, lowerQuery);\n\n\tif (!node.children || node.children.length === 0) {\n\t\treturn selfMatches ? node : undefined;\n\t}\n\n\t// If this node matches, keep the entire subtree\n\tif (selfMatches) return node;\n\n\t// Otherwise, keep only children (recursively) that match\n\tconst filteredChildren: ExplorerTreeNode[] = [];\n\tfor (const child of node.children) {\n\t\tconst filtered = filterNode(child, lowerQuery);\n\t\tif (filtered) filteredChildren.push(filtered);\n\t}\n\n\tif (filteredChildren.length === 0) return undefined;\n\n\treturn {\n\t\t...node,\n\t\tchildren: filteredChildren,\n\t};\n}\n","import { observableValue, type ISettableObservable } from '@vscode/observables';\n\nexport interface LocalStorageObservableOptions<T> {\n readonly storageKey: string;\n readonly defaultValue: T;\n /** Serialize value to string for localStorage. Defaults to JSON.stringify. */\n readonly serialize?: (value: T) => string;\n /** Deserialize string from localStorage. Defaults to JSON.parse. */\n readonly deserialize?: (raw: string) => T;\n}\n\n/**\n * Creates an observable that persists its value to localStorage.\n * The value is loaded from localStorage on creation (if present),\n * and saved to localStorage whenever it changes.\n */\nexport function createLocalStorageObservable<T>(\n owner: object,\n options: LocalStorageObservableOptions<T>\n): ISettableObservable<T> {\n const {\n storageKey,\n defaultValue,\n serialize = JSON.stringify,\n deserialize = JSON.parse,\n } = options;\n\n // Try to load from localStorage\n let initialValue = defaultValue;\n try {\n const stored = localStorage.getItem(storageKey);\n if (stored !== null) {\n initialValue = deserialize(stored);\n }\n } catch {\n // Ignore parse errors, use default\n }\n\n const obs = observableValue<T>(owner, initialValue);\n\n // Wrap the set method to persist to localStorage\n const originalSet = obs.set.bind(obs);\n obs.set = (value: T, tx: undefined) => {\n try {\n localStorage.setItem(storageKey, serialize(value));\n } catch {\n // Ignore storage errors (quota exceeded, etc.)\n }\n originalSet(value, tx);\n };\n\n return obs;\n}\n","import { observableValue, type ISettableObservable } from '@vscode/observables';\n\nexport function createQueryParamObservable(\n owner: object,\n paramName: string,\n): ISettableObservable<string | undefined> {\n const params = new URLSearchParams(location.search);\n const initialValue = params.get(paramName) || undefined;\n\n const obs = observableValue<string | undefined>(owner, initialValue);\n\n window.addEventListener('popstate', () => {\n const p = new URLSearchParams(location.search);\n obs.set(p.get(paramName) || undefined, undefined);\n });\n\n const originalSet = obs.set.bind(obs);\n obs.set = (value: string | undefined, tx: undefined) => {\n const p = new URLSearchParams(location.search);\n if (!value) {\n p.delete(paramName);\n } else {\n p.set(paramName, value);\n }\n const search = p.toString();\n const newUrl = location.pathname + (search ? '?' + search : '') + location.hash;\n history.replaceState(history.state, '', newUrl);\n originalSet(value, tx);\n };\n\n return obs;\n}\n\nexport function buildQueryParamUrl(paramName: string, value: string): string {\n const p = new URLSearchParams(location.search);\n p.set(paramName, value);\n return location.pathname + '?' + p.toString();\n}\n","import { observableValue, derived, IReader } from '@vscode/observables';\nimport { ViewModel, prop } from '@vscode/observables-react';\nimport type { FixtureRegistry, ComponentDefinition } from '../core/index.js';\nimport { FixturePath } from '../core/FixturePath.js';\nimport { type ExplorerTreeNode, toExplorerTree } from './types.js';\nimport { filterTree } from './treeFilter.js';\nimport { createLocalStorageObservable } from '../lib/localStorageObservable.js';\nimport { createQueryParamObservable } from '../lib/queryParamObservable.js';\nimport type { DaemonModel } from '../daemon/index.js';\nimport type { ReportModel } from '../report/ReportModel.js';\nimport type { ReportFixtureItem } from './ReportComparisonRow.js';\n\nexport type ViewMode = 'session' | 'diff' | 'report';\n\n/**\n * A fixture item to be rendered in the preview area.\n */\nexport interface FixtureItem {\n readonly id: string;\n readonly name: string;\n readonly path: string;\n readonly component: ComponentDefinition;\n}\n\n/**\n * A screenshot comparison item for diff mode.\n */\nexport interface ScreenshotComparisonItem {\n readonly fixtureId: string;\n readonly name: string;\n readonly path: string;\n}\n\n/**\n * A preview row can be a live fixture, a variant group, or a screenshot comparison.\n */\nexport type PreviewRow =\n | { readonly type: 'single'; readonly fixture: FixtureItem }\n | { readonly type: 'variants'; readonly id: string; readonly name: string; readonly path: string; readonly fixtures: readonly FixtureItem[] }\n | { readonly type: 'screenshot-comparison'; readonly id: string; readonly name: string; readonly path: string; readonly items: readonly ScreenshotComparisonItem[] }\n | { readonly type: 'report-comparison'; readonly id: string; readonly name: string; readonly path: string; readonly items: readonly ReportFixtureItem[] };\n\nexport class ExplorerModel extends ViewModel({\n registry: prop.const<FixtureRegistry>(),\n daemonModel: prop.const<DaemonModel | undefined>(),\n reportModel: prop.const<ReportModel | undefined>(),\n}) {\n readonly leftSidebarVisible = createLocalStorageObservable<boolean>(this, {\n storageKey: 'component-explorer:leftSidebarVisible',\n defaultValue: true,\n });\n readonly rightSidebarVisible = createLocalStorageObservable<boolean>(this, {\n storageKey: 'component-explorer:rightSidebarVisible',\n defaultValue: false,\n });\n readonly isDarkTheme = createLocalStorageObservable<boolean>(this, {\n storageKey: 'component-explorer:isDarkTheme',\n defaultValue: true,\n });\n readonly selectedNodeId = createQueryParamObservable(this, 'fixture');\n readonly expandedNodeIds = observableValue<ReadonlySet<string>>(this, this._initialExpandedNodes());\n\n readonly viewMode = createLocalStorageObservable<ViewMode>(this, {\n storageKey: 'component-explorer:viewMode',\n defaultValue: 'session',\n });\n\n get daemonAvailable(): boolean { return this.props.daemonModel !== undefined; }\n get daemon(): DaemonModel | undefined { return this.props.daemonModel; }\n get reportModel(): ReportModel | undefined { return this.props.reportModel; }\n get isReportMode(): boolean { return this.props.reportModel !== undefined; }\n\n readonly loading = derived(this, (reader) => this.props.registry.loading.read(reader));\n readonly error = derived(this, (reader) => this.props.registry.error.read(reader));\n\n readonly searchQuery = createQueryParamObservable(this, 'search');\n\n /** The explorer's tree derived from the registry or report */\n readonly tree = derived(this, (reader) => {\n const report = this.props.reportModel;\n if (report) {\n return report.buildTree(reader);\n }\n const root = this.props.registry.root.read(reader);\n return toExplorerTree(root);\n });\n\n readonly filteredTree = derived(this, (reader) => {\n const tree = this.tree.read(reader);\n const query = this.searchQuery.read(reader);\n return filterTree(tree, query) ?? { ...tree, children: [] };\n });\n\n readonly selectedNode = derived(this, (reader) => {\n const nodeId = this.selectedNodeId.read(reader);\n if (nodeId === undefined) return undefined;\n const tree = this.filteredTree.read(reader);\n if (tree.id.value === nodeId) return tree;\n return this._findNode(tree.children ?? [], nodeId);\n });\n\n /** List of preview rows to render based on current selection and view mode */\n readonly selectedFixtures = derived(this, (reader): readonly PreviewRow[] => {\n const selectedNode = this.selectedNode.read(reader);\n if (!selectedNode) return [];\n\n const pathPrefix = selectedNode.type === 'component'\n ? selectedNode.id.segments.slice(-3).join(' / ')\n : selectedNode.name;\n\n if (this.isReportMode) {\n const report = this.props.reportModel!;\n report.state.read(reader);\n return this._collectReportRows(selectedNode, pathPrefix);\n }\n\n const mode = this.viewMode.read(reader);\n if (mode === 'diff' && this.daemonAvailable) {\n const sessions = this.daemon!.sessions.read(reader);\n if (sessions.length > 1) {\n return this._collectDiffRows(selectedNode, pathPrefix);\n }\n }\n\n return this._collectPreviewRows(selectedNode, pathPrefix);\n });\n\n setViewMode = (mode: ViewMode): void => {\n this.viewMode.set(mode, undefined);\n };\n\n navigateToSession = (sessionName: string): void => {\n const daemon = this.props.daemonModel;\n if (!daemon) return;\n const url = daemon.getSessionExplorerUrl(sessionName);\n if (url) {\n window.location.href = url;\n }\n };\n\n toggleLeftSidebar = (): void => {\n this.leftSidebarVisible.set(!this.leftSidebarVisible.get(), undefined);\n };\n\n toggleRightSidebar = (): void => {\n this.rightSidebarVisible.set(!this.rightSidebarVisible.get(), undefined);\n };\n\n toggleTheme = (): void => {\n this.isDarkTheme.set(!this.isDarkTheme.get(), undefined);\n };\n\n selectNode = (nodeId: string): void => {\n this.selectedNodeId.set(nodeId, undefined);\n };\n\n toggleNodeExpanded = (nodeId: string): void => {\n const current = this.expandedNodeIds.get();\n const newSet = new Set(current);\n if (newSet.has(nodeId)) {\n newSet.delete(nodeId);\n } else {\n newSet.add(nodeId);\n }\n this.expandedNodeIds.set(newSet, undefined);\n };\n\n isNodeExpanded(nodeId: string, reader: IReader): boolean {\n if (this.searchQuery.read(reader)) return true;\n return this.expandedNodeIds.read(reader).has(nodeId);\n }\n\n private _initialExpandedNodes(): ReadonlySet<string> {\n const selected = this.selectedNodeId.get();\n if (!selected) return new Set(['']);\n const parts = new FixturePath(selected).segments;\n const expanded = new Set(['']);\n for (let i = 1; i <= parts.length; i++) {\n expanded.add(parts.slice(0, i).join('/'));\n }\n return expanded;\n }\n\n private _findNode(nodes: readonly ExplorerTreeNode[], id: string): ExplorerTreeNode | undefined {\n for (const node of nodes) {\n if (node.id.value === id) return node;\n if (node.children) {\n const found = this._findNode(node.children, id);\n if (found) return found;\n }\n }\n return undefined;\n }\n\n private _collectPreviewRows(node: ExplorerTreeNode, pathPrefix: string): PreviewRow[] {\n if (node.type === 'component' && node.component) {\n return [{\n type: 'single',\n fixture: {\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n component: node.component,\n },\n }];\n }\n\n if (node.type === 'variants') {\n const fixtures: FixtureItem[] = [];\n for (const child of node.children ?? []) {\n if (child.type === 'component' && child.component) {\n fixtures.push({\n id: child.id.value,\n name: child.name,\n path: `${pathPrefix} / ${child.name}`,\n component: child.component,\n });\n }\n }\n if (fixtures.length > 0) {\n return [{\n type: 'variants',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n fixtures,\n }];\n }\n return [];\n }\n\n // Folder: recurse into children\n const result: PreviewRow[] = [];\n for (const child of node.children ?? []) {\n const childPath = pathPrefix ? `${pathPrefix} / ${child.name}` : child.name;\n result.push(...this._collectPreviewRows(child, childPath));\n }\n return result;\n }\n\n /**\n * In diff mode: fixtures become screenshot comparison items showing current vs baseline.\n * Variants become comparison groups.\n */\n private _collectDiffRows(node: ExplorerTreeNode, pathPrefix: string): PreviewRow[] {\n if (node.type === 'component') {\n return [{\n type: 'screenshot-comparison',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n items: [{\n fixtureId: node.id.value,\n name: node.name,\n path: pathPrefix,\n }],\n }];\n }\n\n if (node.type === 'variants') {\n const items: ScreenshotComparisonItem[] = [];\n for (const child of node.children ?? []) {\n if (child.type === 'component') {\n items.push({\n fixtureId: child.id.value,\n name: child.name,\n path: `${pathPrefix} / ${child.name}`,\n });\n }\n }\n if (items.length > 0) {\n return [{\n type: 'screenshot-comparison',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n items,\n }];\n }\n return [];\n }\n\n const result: PreviewRow[] = [];\n for (const child of node.children ?? []) {\n const childPath = pathPrefix ? `${pathPrefix} / ${child.name}` : child.name;\n result.push(...this._collectDiffRows(child, childPath));\n }\n return result;\n }\n\n private _collectReportRows(node: ExplorerTreeNode, pathPrefix: string): PreviewRow[] {\n const reportState = this.props.reportModel!.state.get();\n if (reportState.status !== 'ready') return [];\n const fixtures = reportState.report.fixtures;\n\n if (node.type === 'component') {\n const entry = fixtures[node.id.value];\n if (!entry) return [];\n return [{\n type: 'report-comparison',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n items: [{\n fixtureId: node.id.value,\n name: node.name,\n path: pathPrefix,\n entry,\n }],\n }];\n }\n\n const result: PreviewRow[] = [];\n for (const child of node.children ?? []) {\n const childPath = pathPrefix ? `${pathPrefix} / ${child.name}` : child.name;\n result.push(...this._collectReportRows(child, childPath));\n }\n return result;\n }\n}\n","import * as React from 'react';\n\nexport const styles = {\n container: {\n display: 'flex',\n flexDirection: 'row' as const,\n height: '100%',\n width: '100%',\n fontFamily: 'var(--component-explorer-font-family)',\n fontSize: 'var(--component-explorer-font-size)',\n color: 'var(--component-explorer-foreground)',\n backgroundColor: 'var(--component-explorer-editor-background)',\n },\n centerArea: {\n display: 'flex',\n flexDirection: 'column' as const,\n flex: 1,\n overflow: 'hidden',\n },\n titleBar: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n height: '35px',\n minHeight: '35px',\n padding: '0 10px',\n backgroundColor: 'var(--component-explorer-titleBar-activeBackground)',\n color: 'var(--component-explorer-titleBar-activeForeground)',\n borderBottom: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n titleBarSection: {\n display: 'flex',\n alignItems: 'center',\n gap: '2px',\n },\n titleBarCenter: {\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n fontSize: '13px',\n fontWeight: 400,\n },\n titleBarButton: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '28px',\n height: '28px',\n border: 'none',\n background: 'transparent',\n color: 'var(--component-explorer-titleBar-activeForeground)',\n cursor: 'pointer',\n borderRadius: '4px',\n },\n titleBarButtonHover: {\n backgroundColor: 'var(--component-explorer-toolbar-hoverBackground)',\n },\n titleBarButtonActive: {\n backgroundColor: 'var(--component-explorer-toolbar-activeBackground)',\n color: 'var(--component-explorer-focusBorder)',\n },\n sidebar: {\n display: 'flex',\n flexDirection: 'column' as const,\n width: '260px',\n minWidth: '200px',\n backgroundColor: 'var(--component-explorer-sideBar-background)',\n borderRight: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n sidebarRight: {\n borderRight: 'none',\n borderLeft: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n sidebarHeader: {\n display: 'flex',\n alignItems: 'center',\n height: '35px',\n minHeight: '35px',\n padding: '0 12px',\n fontSize: '11px',\n fontWeight: 700,\n textTransform: 'uppercase' as const,\n letterSpacing: '0.04em',\n color: 'var(--component-explorer-titleBar-activeForeground)',\n backgroundColor: 'var(--component-explorer-titleBar-activeBackground)',\n borderBottom: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n sidebarContent: {\n flex: 1,\n overflow: 'auto',\n padding: '4px 0',\n },\n treeItem: {\n display: 'flex',\n alignItems: 'center',\n height: '22px',\n paddingRight: '8px',\n cursor: 'pointer',\n userSelect: 'none' as const,\n },\n treeItemSelected: {\n backgroundColor: 'var(--component-explorer-list-activeSelectionBackground)',\n color: 'var(--component-explorer-list-activeSelectionForeground)',\n },\n treeItemHover: {\n backgroundColor: 'var(--component-explorer-list-hoverBackground)',\n },\n treeItemChevron: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '16px',\n height: '16px',\n color: 'var(--component-explorer-foreground)',\n opacity: 0.8,\n cursor: 'pointer',\n },\n treeItemChevronPlaceholder: {\n width: '16px',\n },\n treeItemIcon: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '16px',\n height: '16px',\n marginRight: '4px',\n },\n treeItemLabel: {\n flex: 1,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap' as const,\n fontSize: '13px',\n },\n treeItemCount: {\n marginLeft: '8px',\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n },\n mainContent: {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: 'var(--component-explorer-editor-background)',\n color: 'var(--component-explorer-descriptionForeground)',\n fontSize: '14px',\n },\n propertiesPanel: {\n padding: '12px',\n },\n propertyRow: {\n marginBottom: '12px',\n },\n propertyLabel: {\n fontSize: '12px',\n color: 'var(--component-explorer-foreground)',\n marginBottom: '4px',\n },\n propertyDescription: {\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n marginTop: '2px',\n },\n propertyInput: {\n width: '100%',\n height: '26px',\n padding: '0 8px',\n fontSize: '13px',\n color: 'var(--component-explorer-input-foreground)',\n backgroundColor: 'var(--component-explorer-input-background)',\n border: '1px solid var(--component-explorer-input-border, transparent)',\n borderRadius: '2px',\n outline: 'none',\n boxSizing: 'border-box' as const,\n },\n propertySelect: {\n width: '100%',\n height: '26px',\n padding: '0 8px',\n fontSize: '13px',\n color: 'var(--component-explorer-dropdown-foreground)',\n backgroundColor: 'var(--component-explorer-dropdown-background)',\n border: '1px solid var(--component-explorer-dropdown-border)',\n borderRadius: '2px',\n outline: 'none',\n boxSizing: 'border-box' as const,\n cursor: 'pointer',\n },\n} as const;\n\n// Helper to merge styles\nexport function mergeStyles(...styleObjects: (React.CSSProperties | undefined | false)[]): React.CSSProperties {\n return Object.assign({}, ...styleObjects.filter(Boolean));\n}\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { styles, mergeStyles } from './styles.js';\n\nclass TitleBarButtonModel extends ViewModel({\n active: prop<boolean>(),\n}) {\n readonly isHovered = observableValue<boolean>(this, false);\n\n get active() { return this.props.active; }\n\n setHovered = (hovered: boolean): void => {\n this.isHovered.set(hovered, undefined);\n };\n}\n\nexport const TitleBarButton = viewWithModel(\n TitleBarButtonModel,\n {\n onClick: prop.const<() => void>(),\n title: prop.const<string>(),\n children: prop.const<React.ReactNode>(),\n },\n (reader, model, props) => {\n const isHovered = model.isHovered.read(reader);\n const active = model.active.read(reader);\n\n const buttonStyle = mergeStyles(\n styles.titleBarButton,\n isHovered && !active && styles.titleBarButtonHover,\n active && styles.titleBarButtonActive,\n );\n\n return (\n <button\n style={buttonStyle}\n onClick={props.onClick}\n title={props.title}\n onMouseEnter={() => model.setHovered(true)}\n onMouseLeave={() => model.setHovered(false)}\n >\n {props.children}\n </button>\n );\n }\n);\n","import * as React from 'react';\n\nexport const ChevronRightIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M5.7 13.7L5 13l4.6-4.6L5 3.7l.7-.7 5.3 5.4-5.3 5.3z\" />\n </svg>\n);\n\nexport const ChevronDownIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M11 5.5L6 10.5L5.3 9.8L9.6 5.5L5.3 1.2L6 0.5L11 5.5z\" transform=\"rotate(90 8 5.5)\" />\n </svg>\n);\n\nexport const ComponentIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M14.5 2H9l-.35.15-.65.64-.65-.64L7 2H1.5l-.5.5v10l.5.5H7l.35-.15.65-.64.65.64.35.15h5.5l.5-.5v-10l-.5-.5zm-7 10H2V3h5v.86L5.85 5l1.15 1.14V10l-1.15-1.14L7 7.72V12zm6 0H8V7.72l1.15 1.14L8 10V6.14L9.15 5 8 3.86V3h5v9z\" />\n </svg>\n);\n\nexport const FolderIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M14.5 3H7.71l-.85-.85L6.5 2h-5l-.5.5v11l.5.5h13l.5-.5v-10l-.5-.5zm-.5 10H2V6h12v7zm0-8H2V3h4.29l.85.85.36.15H14v1z\" />\n </svg>\n);\n\nexport const PanelLeftIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M2 2v12h12V2H2zm11 11H6V3h7v10zM3 3h2v10H3V3z\" />\n </svg>\n);\n\nexport const PanelRightIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M2 2v12h12V2H2zm6 11V3h5v10H8zM3 3h4v10H3V3z\" />\n </svg>\n);\n\nexport const SunIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z\" />\n </svg>\n);\n\nexport const MoonIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z\" />\n </svg>\n);\n","import { view, prop } from '@vscode/observables-react';\nimport { styles } from './styles.js';\nimport { TitleBarButton } from './TitleBarButton.js';\nimport { PanelLeftIcon, PanelRightIcon, SunIcon, MoonIcon } from './icons.js';\nimport type { ExplorerModel, ViewMode } from './ExplorerModel.js';\n\nconst ViewModeSelector = view(\n { model: prop.const<ExplorerModel>() },\n (reader, props) => {\n const model = props.model;\n const viewMode = model.viewMode.read(reader);\n\n const sessions = model.daemon?.sessions.read(reader) ?? [];\n const currentSession = model.daemon?.sessionName;\n const otherSessions = sessions.filter(s => s.name !== currentSession);\n\n if (sessions.length <= 1) return null;\n\n return (\n <div style={viewModeStyles.container}>\n <div style={viewModeStyles.segmentedControl}>\n <ViewModeButton label=\"Live\" mode=\"session\" active={viewMode === 'session'} onClick={() => model.setViewMode('session')} />\n <ViewModeButton label=\"Diff\" mode=\"diff\" active={viewMode === 'diff'} onClick={() => model.setViewMode('diff')} />\n </div>\n {otherSessions.length > 0 && (\n <div style={viewModeStyles.sessionLinks}>\n {otherSessions.map(s => (\n <button\n key={s.name}\n style={viewModeStyles.sessionLink}\n onClick={() => model.navigateToSession(s.name)}\n title={`Switch to ${s.name} session`}\n >\n → {s.name}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n }\n);\n\nfunction ViewModeButton({ label, mode, active, onClick }: {\n label: string; mode: ViewMode; active: boolean; onClick: () => void;\n}) {\n return (\n <button\n style={active ? viewModeStyles.segmentActive : viewModeStyles.segment}\n onClick={onClick}\n >\n {label}\n </button>\n );\n}\n\nexport const TitleBar = view(\n {\n model: prop.const<ExplorerModel>(),\n },\n (reader, props) => {\n const model = props.model;\n const leftVisible = model.leftSidebarVisible.read(reader);\n const rightVisible = model.rightSidebarVisible.read(reader);\n const isDarkTheme = model.isDarkTheme.read(reader);\n const selectedNode = model.selectedNode.read(reader);\n\n return (\n <div style={styles.titleBar}>\n <div style={styles.titleBarSection}>\n <TitleBarButton\n active={leftVisible}\n onClick={model.toggleLeftSidebar}\n title=\"Toggle left sidebar\"\n >\n <PanelLeftIcon />\n </TitleBarButton>\n </div>\n <div style={styles.titleBarCenter}>\n {model.isReportMode ? (\n <span style={{ fontSize: 12, color: 'var(--component-explorer-descriptionForeground)' }}>\n Screenshot Report\n </span>\n ) : model.daemonAvailable ? (\n <ViewModeSelector model={model} />\n ) : null}\n {selectedNode ? (\n <>\n <span style={{ color: 'var(--component-explorer-textLink-foreground)' }}>&lt;</span>\n <span>{selectedNode.name}</span>\n <span style={{ color: 'var(--component-explorer-textLink-foreground)' }}>/&gt;</span>\n </>\n ) : (\n <span style={{ color: 'var(--component-explorer-descriptionForeground)' }}>No component selected</span>\n )}\n </div>\n <div style={styles.titleBarSection}>\n <TitleBarButton\n active={false}\n onClick={model.toggleTheme}\n title={isDarkTheme ? 'Switch to light theme' : 'Switch to dark theme'}\n >\n {isDarkTheme ? <SunIcon /> : <MoonIcon />}\n </TitleBarButton>\n <TitleBarButton\n active={rightVisible}\n onClick={model.toggleRightSidebar}\n title=\"Toggle right sidebar\"\n >\n <PanelRightIcon />\n </TitleBarButton>\n </div>\n </div>\n );\n }\n);\n\nconst viewModeStyles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n marginRight: 12,\n } as React.CSSProperties,\n segmentedControl: {\n display: 'flex',\n borderRadius: 4,\n overflow: 'hidden',\n border: '1px solid var(--component-explorer-panel-border)',\n } as React.CSSProperties,\n segment: {\n padding: '2px 10px',\n fontSize: 11,\n fontWeight: 500,\n border: 'none',\n background: 'transparent',\n color: 'var(--component-explorer-descriptionForeground)',\n cursor: 'pointer',\n } as React.CSSProperties,\n segmentActive: {\n padding: '2px 10px',\n fontSize: 11,\n fontWeight: 500,\n border: 'none',\n background: 'var(--component-explorer-button-background)',\n color: 'var(--component-explorer-button-foreground)',\n cursor: 'pointer',\n } as React.CSSProperties,\n sessionLinks: {\n display: 'flex',\n gap: 4,\n } as React.CSSProperties,\n sessionLink: {\n padding: '2px 8px',\n fontSize: 11,\n border: '1px solid var(--component-explorer-panel-border)',\n borderRadius: 4,\n background: 'transparent',\n color: 'var(--component-explorer-textLink-foreground)',\n cursor: 'pointer',\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { view, viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { styles, mergeStyles } from './styles.js';\nimport { ChevronRightIcon, ChevronDownIcon, ComponentIcon, FolderIcon } from './icons.js';\nimport type { ExplorerModel } from './ExplorerModel.js';\nimport type { ExplorerTreeNode } from './types.js';\n\nconst labelContainerStyle: React.CSSProperties = {\n display: 'flex',\n gap: '3px',\n marginLeft: '6px',\n overflow: 'hidden',\n flexShrink: 1,\n minWidth: 0,\n};\n\nfunction countFixtures(node: ExplorerTreeNode): number {\n if (node.type === 'component') { return 1; }\n return (node.children ?? []).reduce((sum, child) => sum + countFixtures(child), 0);\n}\n\nconst labelBadgeStyle: React.CSSProperties = {\n fontSize: '10px',\n lineHeight: '14px',\n padding: '0 4px',\n borderRadius: '2px',\n backgroundColor: 'var(--component-explorer-badge-background)',\n color: 'var(--component-explorer-badge-foreground)',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '60px',\n cursor: 'pointer',\n};\n\n// TreeView - renders a list of nodes\nexport const TreeView = view(\n {\n model: prop.const<ExplorerModel>(),\n nodes: prop.const<readonly ExplorerTreeNode[]>(),\n depth: prop.const<number>(),\n },\n (_reader, props) => (\n <>\n {props.nodes.map((node) => (\n <TreeItem key={node.id.value} model={props.model} node={node} depth={props.depth} />\n ))}\n </>\n )\n);\n\n// TreeItem - ViewModel for hover state\nclass TreeItemModel extends ViewModel({\n model: prop.const<ExplorerModel>(),\n node: prop.const<ExplorerTreeNode>(),\n depth: prop.const<number>(),\n}) {\n readonly isHovered = observableValue<boolean>(this, false);\n\n // Expose props for render function\n get explorerModel(): ExplorerModel { return this.props.model; }\n get treeNode(): ExplorerTreeNode { return this.props.node; }\n get treeDepth(): number { return this.props.depth; }\n\n setHovered = (hovered: boolean): void => {\n this.isHovered.set(hovered, undefined);\n };\n\n handleClick = (): void => {\n this.props.model.selectNode(this.props.node.id.value);\n };\n\n handleDoubleClick = (): void => {\n if (this._hasChildren) {\n this.props.model.toggleNodeExpanded(this.props.node.id.value);\n }\n };\n\n handleChevronClick = (e: React.MouseEvent): void => {\n e.stopPropagation();\n this.props.model.toggleNodeExpanded(this.props.node.id.value);\n };\n\n private get _hasChildren(): boolean {\n return !!(this.props.node.children && this.props.node.children.length > 0);\n }\n}\n\nexport const TreeItem = viewWithModel(TreeItemModel, {}, (reader, itemModel) => {\n const model = itemModel.explorerModel;\n const node = itemModel.treeNode;\n const depth = itemModel.treeDepth;\n const hasChildren = !!(node.children && node.children.length > 0);\n const isExpanded = hasChildren ? model.isNodeExpanded(node.id.value, reader) : false;\n const selectedId = model.selectedNodeId.read(reader);\n const isSelected = selectedId === node.id.value;\n const isHovered = itemModel.isHovered.read(reader);\n\n const itemStyle = mergeStyles(\n styles.treeItem,\n { paddingLeft: `${8 + depth * 12}px` },\n isSelected && styles.treeItemSelected,\n !isSelected && isHovered && styles.treeItemHover,\n );\n\n return (\n <>\n <div\n style={itemStyle}\n onClick={itemModel.handleClick}\n onDoubleClick={itemModel.handleDoubleClick}\n onMouseEnter={() => itemModel.setHovered(true)}\n onMouseLeave={() => itemModel.setHovered(false)}\n >\n {hasChildren ? (\n <div style={styles.treeItemChevron} onClick={itemModel.handleChevronClick}>\n {isExpanded ? <ChevronDownIcon /> : <ChevronRightIcon />}\n </div>\n ) : (\n <div style={styles.treeItemChevronPlaceholder} />\n )}\n <div style={styles.treeItemIcon}>\n {node.type === 'folder' \n ? <FolderIcon style={{ color: 'var(--component-explorer-symbolIcon-folderForeground)' }} />\n : <ComponentIcon style={{ color: '#deb45b' }} />\n }\n </div>\n <span style={styles.treeItemLabel}>{node.name}</span>\n {node.labels.some(l => !l.startsWith('.')) && (\n <span style={labelContainerStyle}>\n {node.labels.filter(l => !l.startsWith('.')).map((label) => (\n <span\n key={label}\n style={labelBadgeStyle}\n onClick={(e) => { e.stopPropagation(); model.searchQuery.set(label, undefined); }}\n title={label}\n >\n {label}\n </span>\n ))}\n </span>\n )}\n {node.type === 'folder' && hasChildren && (\n <span style={styles.treeItemCount}>{countFixtures(node)}</span>\n )}\n </div>\n {hasChildren && isExpanded && (\n <TreeView model={model} nodes={node.children!} depth={depth + 1} />\n )}\n </>\n );\n});\n","import * as React from 'react';\nimport { view, prop } from '@vscode/observables-react';\nimport type { ExplorerModel } from './ExplorerModel.js';\n\nconst searchContainerStyle: React.CSSProperties = {\n\tpadding: '4px 8px',\n\tborderBottom: '1px solid var(--component-explorer-panel-border)',\n};\n\nconst searchInputStyle: React.CSSProperties = {\n\twidth: '100%',\n\theight: '24px',\n\tpadding: '0 22px 0 6px',\n\tfontSize: '12px',\n\tcolor: 'var(--component-explorer-input-foreground)',\n\tbackgroundColor: 'var(--component-explorer-input-background)',\n\tborder: '1px solid var(--component-explorer-input-border, transparent)',\n\tborderRadius: '2px',\n\toutline: 'none',\n\tboxSizing: 'border-box',\n};\n\nconst searchWrapperStyle: React.CSSProperties = {\n\tposition: 'relative',\n};\n\nconst clearButtonStyle: React.CSSProperties = {\n\tposition: 'absolute',\n\tright: '2px',\n\ttop: '50%',\n\ttransform: 'translateY(-50%)',\n\tdisplay: 'flex',\n\talignItems: 'center',\n\tjustifyContent: 'center',\n\twidth: '18px',\n\theight: '18px',\n\tborder: 'none',\n\tbackground: 'transparent',\n\tcolor: 'var(--component-explorer-input-foreground)',\n\tcursor: 'pointer',\n\tborderRadius: '2px',\n\tfontSize: '14px',\n\topacity: 0.7,\n};\n\nexport const SearchInput = view(\n\t{\n\t\tmodel: prop.const<ExplorerModel>(),\n\t},\n\t(reader, props) => {\n\t\tconst query = props.model.searchQuery.read(reader);\n\t\treturn (\n\t\t\t<div style={searchContainerStyle}>\n\t\t\t\t<div style={searchWrapperStyle}>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tplaceholder=\"Filter (name or label)\"\n\t\t\t\t\t\tstyle={searchInputStyle}\n\t\t\t\t\t\tvalue={query ?? ''}\n\t\t\t\t\t\tonChange={(e) => props.model.searchQuery.set(e.target.value || undefined, undefined)}\n\t\t\t\t\t\tonFocus={(e) => (e.target.style.borderColor = 'var(--component-explorer-focusBorder)')}\n\t\t\t\t\t\tonBlur={(e) => (e.target.style.borderColor = 'var(--component-explorer-input-border, transparent)')}\n\t\t\t\t\t/>\n\t\t\t\t\t{query && (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tstyle={clearButtonStyle}\n\t\t\t\t\t\t\tonClick={() => props.model.searchQuery.set(undefined, undefined)}\n\t\t\t\t\t\t\ttitle=\"Clear filter\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t×\n\t\t\t\t\t\t</button>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n","import { view, prop } from '@vscode/observables-react';\nimport { styles } from './styles.js';\nimport { TreeView } from './TreeView.js';\nimport type { ExplorerModel } from './ExplorerModel.js';\nimport { SearchInput } from './SearchInput.js';\n\nexport const LeftSidebar = view(\n {\n model: prop.const<ExplorerModel>(),\n },\n (reader, props) => {\n const tree = props.model.filteredTree.read(reader);\n return (\n <div style={styles.sidebar}>\n <div style={styles.sidebarHeader}>Explorer</div>\n <SearchInput model={props.model} />\n <div style={styles.sidebarContent}>\n <TreeView model={props.model} nodes={[tree]} depth={0} />\n </div>\n </div>\n );\n }\n);\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { view, viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { styles, mergeStyles } from './styles.js';\nimport type { ExplorerTreeNode } from './types.js';\n\n// ToggleSwitch with observable state\nclass ToggleSwitchModel extends ViewModel({}) {\n readonly checked = observableValue<boolean>(this, false);\n\n toggle = (): void => {\n this.checked.set(!this.checked.get(), undefined);\n };\n}\n\nconst ToggleSwitch = viewWithModel(ToggleSwitchModel, {}, (reader, model) => {\n const checked = model.checked.read(reader);\n\n const trackStyle: React.CSSProperties = {\n position: 'relative',\n width: '36px',\n height: '18px',\n backgroundColor: checked ? 'var(--component-explorer-button-background)' : 'var(--component-explorer-input-background)',\n borderRadius: '9px',\n cursor: 'pointer',\n transition: 'background-color 0.2s',\n border: '1px solid var(--component-explorer-input-border, transparent)',\n };\n\n const thumbStyle: React.CSSProperties = {\n position: 'absolute',\n top: '2px',\n left: checked ? '18px' : '2px',\n width: '12px',\n height: '12px',\n backgroundColor: 'var(--component-explorer-foreground)',\n borderRadius: '50%',\n transition: 'left 0.2s',\n };\n\n return (\n <div style={trackStyle} onClick={model.toggle}>\n <div style={thumbStyle} />\n </div>\n );\n});\n\n// PropertiesContent - shows mock properties for a component\nconst PropertiesContent = view(\n {\n node: prop.const<ExplorerTreeNode>(),\n },\n (_reader, props) => {\n if (props.node.type !== 'component') {\n return (\n <div style={{ padding: '12px', color: 'var(--component-explorer-descriptionForeground)', fontSize: '12px' }}>\n Select a component (not a folder) to view its properties\n </div>\n );\n }\n\n return (\n <div style={styles.propertiesPanel}>\n <div style={styles.propertyRow}>\n <div style={styles.propertyLabel}>\n children<span style={{ color: 'var(--component-explorer-descriptionForeground)' }}> : string</span>\n </div>\n <input\n type=\"text\"\n style={styles.propertyInput as React.CSSProperties}\n defaultValue=\"Click me\"\n placeholder=\"Enter text...\"\n />\n <div style={styles.propertyDescription}>Button text content</div>\n </div>\n\n <div style={styles.propertyRow}>\n <div style={styles.propertyLabel}>\n variant<span style={{ color: 'var(--component-explorer-descriptionForeground)' }}> : select</span>\n </div>\n <select style={styles.propertySelect as React.CSSProperties} defaultValue=\"default\">\n <option value=\"default\">default</option>\n <option value=\"primary\">primary</option>\n <option value=\"secondary\">secondary</option>\n <option value=\"destructive\">destructive</option>\n </select>\n <div style={styles.propertyDescription}>Visual style variant</div>\n </div>\n\n <div style={styles.propertyRow}>\n <div style={styles.propertyLabel}>\n size<span style={{ color: 'var(--component-explorer-descriptionForeground)' }}> : select</span>\n </div>\n <select style={styles.propertySelect as React.CSSProperties} defaultValue=\"default\">\n <option value=\"sm\">sm</option>\n <option value=\"default\">default</option>\n <option value=\"lg\">lg</option>\n </select>\n <div style={styles.propertyDescription}>Button size</div>\n </div>\n\n <div style={styles.propertyRow}>\n <div style={styles.propertyLabel}>\n disabled<span style={{ color: 'var(--component-explorer-descriptionForeground)' }}> : boolean</span>\n </div>\n <ToggleSwitch />\n <div style={styles.propertyDescription}>Disable the button</div>\n </div>\n </div>\n );\n }\n);\n\n// RightSidebar\nexport const RightSidebar = view(\n {\n selectedNode: prop.const<ExplorerTreeNode | undefined>(),\n },\n (_reader, props) => (\n <div style={mergeStyles(styles.sidebar, styles.sidebarRight)}>\n <div style={styles.sidebarHeader}>\n <span style={{ marginRight: '6px', color: 'var(--component-explorer-textLink-foreground)' }}>&lt;/&gt;</span>\n Props\n </div>\n <div style={styles.sidebarContent}>\n {props.selectedNode ? (\n <PropertiesContent node={props.selectedNode} />\n ) : (\n <div style={{ padding: '12px', color: 'var(--component-explorer-descriptionForeground)', fontSize: '12px' }}>\n Select a component to view its properties\n </div>\n )}\n </div>\n </div>\n )\n);\n","const MAX_ENTRIES = 500;\n\ntype CachedHeights = Record<string, number>;\n\nfunction createHeightCache(storageKey: string) {\n let _cache: CachedHeights | null = null;\n\n function load(): CachedHeights {\n if (_cache !== null) return _cache;\n try {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n _cache = JSON.parse(stored);\n return _cache!;\n }\n } catch { /* ignore */ }\n _cache = {};\n return _cache;\n }\n\n function save(): void {\n if (_cache === null) return;\n try {\n const entries = Object.entries(_cache);\n if (entries.length > MAX_ENTRIES) {\n _cache = Object.fromEntries(entries.slice(-MAX_ENTRIES));\n }\n localStorage.setItem(storageKey, JSON.stringify(_cache));\n } catch { /* ignore */ }\n }\n\n return {\n get(id: string): number | undefined { return load()[id]; },\n set(id: string, height: number): void { load()[id] = height; save(); },\n getAll(): ReadonlyMap<string, number> { return new Map(Object.entries(load())); },\n };\n}\n\nconst _rowHeights = createHeightCache('component-explorer:fixtureHeights');\nconst _contentHeights = createHeightCache('component-explorer:fixtureContentHeights');\n\nexport function setCachedHeight(fixtureId: string, height: number): void { _rowHeights.set(fixtureId, height); }\nexport function getCachedHeight(fixtureId: string): number | undefined { return _rowHeights.get(fixtureId); }\nexport function getAllCachedHeights(): ReadonlyMap<string, number> { return _rowHeights.getAll(); }\n\nexport function setCachedContentHeight(fixtureId: string, height: number): void { _contentHeights.set(fixtureId, height); }\nexport function getCachedContentHeight(fixtureId: string): number | undefined { return _contentHeights.get(fixtureId); }\n","import { observableValue, type IObservable, type ISettableObservable, type IReader, derived } from '@vscode/observables';\nimport type { RenderEventType } from './ErrorInfo.js';\n\nexport interface ConsoleEvent {\n\treadonly id: number;\n\treadonly timestamp: number;\n\treadonly type: RenderEventType;\n\treadonly message: string;\n\treadonly stack?: string;\n}\n\nlet _nextEventId = 0;\n\n/**\n * Global store for console events (console.error, console.warn, window errors, unhandled rejections).\n * Events are captured globally and cannot be attributed to specific fixtures since they render in parallel.\n */\nexport class ConsoleEventsStore {\n\tprivate static _instance: ConsoleEventsStore | undefined;\n\n\tstatic getInstance(): ConsoleEventsStore {\n\t\tif (!this._instance) {\n\t\t\tthis._instance = new ConsoleEventsStore();\n\t\t}\n\t\treturn this._instance;\n\t}\n\n\tprivate readonly _events: ISettableObservable<readonly ConsoleEvent[]>;\n\tprivate _installed = false;\n\tprivate _originalConsoleError: typeof console.error | undefined;\n\tprivate _originalConsoleWarn: typeof console.warn | undefined;\n\n\tprivate constructor() {\n\t\tthis._events = observableValue<readonly ConsoleEvent[]>(this, []);\n\t}\n\n\tget events(): IObservable<readonly ConsoleEvent[]> {\n\t\treturn this._events;\n\t}\n\n\tget errorCount(): { read(reader: IReader): number } {\n\t\treturn derived(this, reader => {\n\t\t\tconst events = this._events.read(reader);\n\t\t\treturn events.filter((e: ConsoleEvent) => e.type === 'console.error' || e.type === 'window.error' || e.type === 'window.unhandledrejection').length;\n\t\t});\n\t}\n\n\tinstall(): void {\n\t\tif (this._installed) return;\n\t\tthis._installed = true;\n\n\t\t// Intercept console.error\n\t\tthis._originalConsoleError = console.error;\n\t\tconsole.error = (...args: unknown[]) => {\n\t\t\tthis._addEvent('console.error', args.map(String).join(' '));\n\t\t\tthis._originalConsoleError!.apply(console, args);\n\t\t};\n\n\t\t// Intercept console.warn\n\t\tthis._originalConsoleWarn = console.warn;\n\t\tconsole.warn = (...args: unknown[]) => {\n\t\t\tthis._addEvent('console.warn', args.map(String).join(' '));\n\t\t\tthis._originalConsoleWarn!.apply(console, args);\n\t\t};\n\n\t\t// Listen for window errors\n\t\twindow.addEventListener('error', (event) => {\n\t\t\tthis._addEvent('window.error', event.message, event.error?.stack);\n\t\t});\n\n\t\t// Listen for unhandled promise rejections\n\t\twindow.addEventListener('unhandledrejection', (event) => {\n\t\t\tconst reason = event.reason;\n\t\t\tconst message = reason instanceof Error ? reason.message : String(reason);\n\t\t\tconst stack = reason instanceof Error ? reason.stack : undefined;\n\t\t\tthis._addEvent('window.unhandledrejection', message, stack);\n\t\t});\n\t}\n\n\tprivate _addEvent(type: RenderEventType, message: string, stack?: string): void {\n\t\tconst event: ConsoleEvent = {\n\t\t\tid: _nextEventId++,\n\t\t\ttimestamp: Date.now(),\n\t\t\ttype,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t};\n\t\tthis._events.set([...this._events.get(), event], undefined);\n\t}\n\n\t/**\n\t * Add an event programmatically (e.g., forwarded from an iframe).\n\t */\n\taddEvent(type: RenderEventType, message: string, stack?: string): void {\n\t\tthis._addEvent(type, message, stack);\n\t}\n\n\tclear(): void {\n\t\tthis._events.set([], undefined);\n\t}\n}\n","import type { ComponentDefinition } from './fixtureApiConsumer.js';\nimport type { IDisposable, RenderResult, StyleDefinition } from './fixtureApi.js';\nimport type { ExceptionError, RenderEventType } from './ErrorInfo.js';\nimport { getCachedContentHeight, setCachedContentHeight } from '../lib/fixtureSizeCache.js';\nimport { ConsoleEventsStore } from './ConsoleEventsStore.js';\n\nfunction injectStyles(\n\tstyles: readonly StyleDefinition[],\n\ttargetDoc: Document | ShadowRoot,\n): { injectedElements: HTMLElement[]; adoptedSheets: CSSStyleSheet[] } {\n\tconst injectedElements: HTMLElement[] = [];\n\tconst adoptedSheets: CSSStyleSheet[] = [];\n\tconst appendTarget = targetDoc instanceof ShadowRoot ? targetDoc : targetDoc.head;\n\tfor (const style of styles) {\n\t\tif (style.type === 'css') {\n\t\t\tconst styleEl = document.createElement('style');\n\t\t\tstyleEl.textContent = style.content;\n\t\t\tappendTarget.appendChild(styleEl);\n\t\t\tinjectedElements.push(styleEl);\n\t\t} else if (style.type === 'url') {\n\t\t\tconst linkEl = document.createElement('link');\n\t\t\tlinkEl.rel = 'stylesheet';\n\t\t\tlinkEl.href = style.href;\n\t\t\tappendTarget.appendChild(linkEl);\n\t\t\tinjectedElements.push(linkEl);\n\t\t} else if (style.type === 'adopted') {\n\t\t\ttargetDoc.adoptedStyleSheets = [...targetDoc.adoptedStyleSheets, style.sheet];\n\t\t\tadoptedSheets.push(style.sheet);\n\t\t}\n\t}\n\treturn { injectedElements, adoptedSheets };\n}\n\nfunction removeStyles(\n\tinjectedElements: HTMLElement[],\n\tadoptedSheets: CSSStyleSheet[],\n\ttargetDoc: Document | ShadowRoot,\n): void {\n\tfor (const el of injectedElements) {\n\t\tel.remove();\n\t}\n\tfor (const sheet of adoptedSheets) {\n\t\ttargetDoc.adoptedStyleSheets = targetDoc.adoptedStyleSheets.filter(s => s !== sheet);\n\t}\n}\n\nexport class ComponentRendering {\n\treadonly renderTarget: HTMLElement;\n\treadonly iframe: HTMLIFrameElement | null = null;\n\tprivate readonly _abortController = new AbortController();\n\tprivate _resolvedResult: RenderResult | { error: ExceptionError } | undefined;\n\tprivate _injectedElements: HTMLElement[] = [];\n\tprivate _adoptedSheets: CSSStyleSheet[] = [];\n\tprivate _styleTarget: Document | ShadowRoot = document;\n\tprivate readonly _disposables: IDisposable[] = [];\n\tprivate readonly _rendered: Promise<RenderResult | undefined>;\n\n\tconstructor(host: HTMLElement, readonly component: ComponentDefinition) {\n\t\tconst isolation = component.isolation;\n\n\t\tif (isolation === 'shadow-dom') {\n\t\t\tconst shadowRoot = host.attachShadow({ mode: 'open' });\n\t\t\tthis._styleTarget = shadowRoot;\n\t\t\tif (component.styles) {\n\t\t\t\tconst { injectedElements, adoptedSheets } = injectStyles(component.styles, shadowRoot);\n\t\t\t\tthis._injectedElements = injectedElements;\n\t\t\t\tthis._adoptedSheets = adoptedSheets;\n\t\t\t}\n\t\t\tthis.renderTarget = document.createElement('div');\n\t\t\tshadowRoot.appendChild(this.renderTarget);\n\t\t} else if (isolation === 'iframe') {\n\t\t\tconst iframe = document.createElement('iframe');\n\t\t\tiframe.style.border = 'none';\n\t\t\tiframe.style.display = 'block';\n\t\t\tiframe.style.width = '100%';\n\t\t\tiframe.style.height = (getCachedContentHeight(component.id) ?? 0) + 'px';\n\n\t\t\tconst url = new URL(location.pathname, location.origin);\n\t\t\turl.searchParams.set('mode', 'embedded');\n\t\t\turl.searchParams.set('fixture', component.id);\n\t\t\turl.searchParams.set('file', component.sourceFile);\n\t\t\tiframe.src = url.toString();\n\t\t\thost.appendChild(iframe);\n\t\t\tthis.iframe = iframe;\n\n\t\t\tlet rejectRendered: ((error: ExceptionError) => void) | undefined;\n\t\t\tconst onMessage = (e: MessageEvent) => {\n\t\t\t\tif (e.source !== iframe.contentWindow) return;\n\t\t\t\tif (e.data?.type === 'component-explorer:resize') {\n\t\t\t\t\tconst height = e.data.height;\n\t\t\t\t\tiframe.style.height = height + 'px';\n\t\t\t\t\tsetCachedContentHeight(component.id, height);\n\t\t\t\t} else if (e.data?.type === 'component-explorer:error') {\n\t\t\t\t\tconst error = e.data.error as ExceptionError;\n\t\t\t\t\tthis._resolvedResult = { error };\n\t\t\t\t\trejectRendered?.(error);\n\t\t\t\t\trejectRendered = undefined;\n\t\t\t\t} else if (e.data?.type === 'component-explorer:console') {\n\t\t\t\t\t// Forward iframe console events to the global store\n\t\t\t\t\tConsoleEventsStore.getInstance().addEvent(\n\t\t\t\t\t\te.data.eventType as RenderEventType,\n\t\t\t\t\t\te.data.message,\n\t\t\t\t\t\te.data.stack\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('message', onMessage);\n\t\t\tthis._abortController.signal.addEventListener('abort', () => {\n\t\t\t\twindow.removeEventListener('message', onMessage);\n\t\t\t});\n\n\t\t\tthis.renderTarget = iframe;\n\t\t\tthis._rendered = new Promise<RenderResult | undefined>((_, reject) => {\n\t\t\t\trejectRendered = reject;\n\t\t\t});\n\t\t\treturn;\n\t\t} else {\n\t\t\tif (component.styles) {\n\t\t\t\tconst { injectedElements, adoptedSheets } = injectStyles(component.styles, document);\n\t\t\t\tthis._injectedElements = injectedElements;\n\t\t\t\tthis._adoptedSheets = adoptedSheets;\n\t\t\t}\n\t\t\tthis.renderTarget = document.createElement('div');\n\t\t\thost.appendChild(this.renderTarget);\n\t\t}\n\n\t\tlet rawResult: RenderResult | void | Promise<RenderResult | void>;\n\t\ttry {\n\t\t\trawResult = component.render(this.renderTarget, {\n\t\t\t\tsignal: this._abortController.signal,\n\t\t\t\taddDisposable: <T extends IDisposable>(d: T): T => { this._disposables.push(d); return d; },\n\t\t\t});\n\t\t} catch (err) {\n\t\t\tconst error: ExceptionError = {\n\t\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t\t\tstack: err instanceof Error ? err.stack : undefined,\n\t\t\t};\n\t\t\tthis._resolvedResult = { error };\n\t\t\tthis._rendered = Promise.reject(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (rawResult instanceof Promise) {\n\t\t\tthis._rendered = rawResult.then((resolved) => {\n\t\t\t\tif (this._abortController.signal.aborted) {\n\t\t\t\t\tresolved?.dispose?.();\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tthis._resolvedResult = resolved ?? undefined;\n\t\t\t\treturn this._resolvedResult as RenderResult | undefined;\n\t\t\t}).catch((err) => {\n\t\t\t\tconst error: ExceptionError = {\n\t\t\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t\t\t\tstack: err instanceof Error ? err.stack : undefined,\n\t\t\t\t};\n\t\t\t\tthis._resolvedResult = { error };\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t} else {\n\t\t\tthis._resolvedResult = (rawResult ?? undefined) as RenderResult | undefined;\n\t\t\tthis._rendered = Promise.resolve(this._resolvedResult as RenderResult | undefined);\n\t\t}\n\t}\n\n\tasync waitForRendering(): Promise<RenderResult | undefined> {\n\t\tconst result = await this._rendered;\n\t\tawait result?.ready;\n\t\treturn result;\n\t}\n\n\tdispose(): void {\n\t\tthis._abortController.abort();\n\t\tif (this._resolvedResult && !('error' in this._resolvedResult)) {\n\t\t\tthis._resolvedResult.dispose?.();\n\t\t}\n\t\tthis._resolvedResult = undefined;\n\t\tfor (const d of this._disposables) {\n\t\t\td.dispose();\n\t\t}\n\t\tthis._disposables.length = 0;\n\t\tremoveStyles(this._injectedElements, this._adoptedSheets, this._styleTarget);\n\t}\n}\n","let _shadowHost: HTMLElement | undefined;\n\nexport function setExplorerShadowHost(host: HTMLElement): void {\n\t_shadowHost = host;\n}\n\nexport function getExplorerShadowHost(): HTMLElement {\n\tif (!_shadowHost) {\n\t\tthrow new Error('Explorer shadow host not initialized');\n\t}\n\treturn _shadowHost;\n}\n","const _fixtureContainers = new WeakSet<HTMLElement>();\n\nconst _originalFocus = HTMLElement.prototype.focus;\nHTMLElement.prototype.focus = function (this: HTMLElement, options?: FocusOptions) {\n\tif (!options?.preventScroll && isInsideFixtureContainer(this)) {\n\t\t_originalFocus.call(this, { ...options, preventScroll: true });\n\t} else {\n\t\t_originalFocus.call(this, options);\n\t}\n};\n\nfunction isInsideFixtureContainer(el: HTMLElement): boolean {\n\tlet node: Element | null = el;\n\twhile (node) {\n\t\tif (node instanceof HTMLElement && _fixtureContainers.has(node)) {\n\t\t\treturn true;\n\t\t}\n\t\tnode = node.parentElement;\n\t}\n\treturn false;\n}\n\nexport function registerFixtureContainer(container: HTMLElement): void {\n\t_fixtureContainers.add(container);\n}\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { resolveViewport } from '../core/index.js';\nimport { ComponentRendering } from '../core/ComponentRenderer.js';\nimport type { ExceptionError } from '../core/ErrorInfo.js';\nimport type { FixtureItem } from './ExplorerModel.js';\nimport { buildQueryParamUrl } from '../lib/queryParamObservable.js';\nimport { getExplorerShadowHost } from '../lib/explorerShadowHost.js';\nimport { registerFixtureContainer } from '../lib/fixtureFocusTrap.js';\n\nlet _nextSlotId = 0;\n\nclass FixturePreviewItemModel extends ViewModel({\n fixture: prop.const<FixtureItem>(),\n compact: prop.const<boolean | undefined>(),\n onSelect: prop.const<((nodeId: string) => void) | undefined>(),\n}) {\n private _canvasRef: HTMLDivElement | null = null;\n private _fixtureContainer: HTMLDivElement | null = null;\n private _rendering: ComponentRendering | null = null;\n private _resizeObserver: ResizeObserver | null = null;\n\n readonly measuredWidth = observableValue<number | undefined>(this, undefined);\n readonly measuredHeight = observableValue<number | undefined>(this, undefined);\n readonly error = observableValue<ExceptionError | undefined>(this, undefined);\n readonly slotName = `fixture-${_nextSlotId++}`;\n\n get fixture(): FixtureItem { return this.props.fixture; }\n get compact(): boolean { return this.props.compact ?? false; }\n get onSelect(): ((nodeId: string) => void) | undefined { return this.props.onSelect; }\n\n setCanvasRef = (el: HTMLDivElement | null): void => {\n if (el === this._canvasRef) return;\n\n this._cleanup();\n\n this._canvasRef = el;\n if (!el) return;\n\n const shadowHost = getExplorerShadowHost();\n\n const fixtureContainer = document.createElement('div');\n fixtureContainer.slot = this.slotName;\n\n const component = this.fixture.component;\n const displayMode = component.displayMode;\n if (displayMode.type === 'page') {\n const viewport = displayMode.viewports[0];\n const resolved = resolveViewport(viewport);\n fixtureContainer.style.width = `${resolved.width}px`;\n fixtureContainer.style.height = `${resolved.height}px`;\n fixtureContainer.style.overflow = 'auto';\n } else {\n fixtureContainer.style.all = 'initial';\n fixtureContainer.style.display = 'inline-block';\n }\n\n shadowHost.appendChild(fixtureContainer);\n this._fixtureContainer = fixtureContainer;\n registerFixtureContainer(fixtureContainer);\n\n const rendering = new ComponentRendering(fixtureContainer, component);\n this._rendering = rendering;\n\n rendering.waitForRendering().catch((err) => {\n this.error.set(err as ExceptionError, undefined);\n });\n\n this._resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n if (height > 0) {\n this.measuredWidth.set(Math.round(width), undefined);\n this.measuredHeight.set(Math.round(height), undefined);\n }\n }\n });\n this._resizeObserver.observe(rendering.renderTarget);\n };\n\n private _cleanup(): void {\n this._rendering?.dispose();\n this._rendering = null;\n this._resizeObserver?.disconnect();\n this._resizeObserver = null;\n this._fixtureContainer?.remove();\n this._fixtureContainer = null;\n this.error.set(undefined, undefined);\n }\n\n dispose(): void {\n this._cleanup();\n }\n}\n\nexport const FixturePreviewItem = viewWithModel(\n FixturePreviewItemModel,\n {},\n (reader, model) => {\n const fixture = model.fixture;\n const component = fixture.component;\n const measuredWidth = model.measuredWidth.read(reader);\n const measuredHeight = model.measuredHeight.read(reader);\n const error = model.error.read(reader);\n const compact = model.compact;\n\n const dimensionsText = measuredWidth && measuredHeight\n ? `${measuredWidth} × ${measuredHeight}`\n : '';\n\n const wrapperStyle = compact ? previewItemStyles.wrapperCompact : previewItemStyles.wrapper;\n const nameStyle = compact ? previewItemStyles.nameCompact : previewItemStyles.name;\n\n return (\n <div style={wrapperStyle}>\n <div style={previewItemStyles.labelRow}>\n {compact && (\n <a\n href={buildQueryParamUrl('fixture', fixture.id)}\n style={{ ...nameStyle, textDecoration: 'none', color: 'inherit' }}\n onClick={(e) => { if (model.onSelect) { e.preventDefault(); model.onSelect(fixture.id); } }}\n >{fixture.name}</a>\n )}\n {!compact && dimensionsText && (\n <span style={previewItemStyles.dimensions}>{dimensionsText}</span>\n )}\n </div>\n <div ref={model.setCanvasRef} style={getCanvasStyle(component.background)}>\n <slot name={model.slotName} />\n </div>\n {error && <FixtureError error={error} />}\n </div>\n );\n }\n);\n\n// Checkered pattern for transparency background (Figma-style)\nconst CHECKER_SIZE = 8;\n\nfunction createCheckerPattern(baseColor: string, checkerColor: string): string {\n return `\n linear-gradient(45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(-45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, ${checkerColor} 75%),\n linear-gradient(-45deg, transparent 75%, ${checkerColor} 75%)\n `;\n}\n\nconst lightPattern = {\n backgroundColor: '#ffffff',\n backgroundImage: createCheckerPattern('#ffffff', '#e5e5e5'),\n};\n\nconst darkPattern = {\n backgroundColor: '#1e1e1e',\n backgroundImage: createCheckerPattern('#1e1e1e', '#2d2d2d'),\n};\n\nconst canvasBaseStyle: React.CSSProperties = {\n display: 'inline-block',\n padding: '12px',\n borderRadius: '4px',\n backgroundSize: `${CHECKER_SIZE * 2}px ${CHECKER_SIZE * 2}px`,\n backgroundPosition: `0 0, 0 ${CHECKER_SIZE}px, ${CHECKER_SIZE}px -${CHECKER_SIZE}px, -${CHECKER_SIZE}px 0`,\n boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)',\n overflow: 'hidden',\n position: 'relative',\n};\n\nfunction getCanvasStyle(background: 'light' | 'dark'): React.CSSProperties {\n const pattern = background === 'dark' ? darkPattern : lightPattern;\n return {\n ...canvasBaseStyle,\n backgroundColor: pattern.backgroundColor,\n backgroundImage: pattern.backgroundImage,\n };\n}\n\nconst previewItemStyles = {\n wrapper: {\n marginBottom: '32px',\n } as React.CSSProperties,\n wrapperCompact: {\n marginBottom: '0',\n } as React.CSSProperties,\n labelRow: {\n display: 'flex',\n alignItems: 'baseline',\n gap: '8px',\n marginBottom: '8px',\n } as React.CSSProperties,\n name: {\n fontSize: '12px',\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n nameCompact: {\n fontSize: '11px',\n fontWeight: 500,\n color: 'var(--component-explorer-descriptionForeground)',\n } as React.CSSProperties,\n dimensions: {\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n fontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n } as React.CSSProperties,\n};\n\nfunction FixtureError({ error }: { error: ExceptionError }): React.ReactElement {\n const [expanded, setExpanded] = React.useState(false);\n\n return (\n <div style={errorStyles.container}>\n <button\n style={errorStyles.header}\n onClick={() => setExpanded(!expanded)}\n >\n <span style={errorStyles.chevron}>{expanded ? '▼' : '▶'}</span>\n <span style={errorStyles.message}>{error.message}</span>\n </button>\n {expanded && error.stack && (\n <pre style={errorStyles.stack}>{error.stack}</pre>\n )}\n </div>\n );\n}\n\nconst errorStyles = {\n container: {\n marginTop: '8px',\n borderRadius: '4px',\n backgroundColor: 'rgba(255, 80, 80, 0.1)',\n border: '1px solid rgba(255, 80, 80, 0.3)',\n overflow: 'hidden',\n } as React.CSSProperties,\n header: {\n display: 'flex',\n alignItems: 'flex-start',\n gap: '6px',\n width: '100%',\n padding: '8px 10px',\n backgroundColor: 'transparent',\n border: 'none',\n cursor: 'pointer',\n textAlign: 'left',\n fontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n fontSize: '12px',\n userSelect: 'text',\n } as React.CSSProperties,\n chevron: {\n fontSize: '10px',\n color: '#f77',\n flexShrink: 0,\n marginTop: '2px',\n } as React.CSSProperties,\n message: {\n color: '#f77',\n wordBreak: 'break-word',\n userSelect: 'text',\n } as React.CSSProperties,\n stack: {\n margin: 0,\n padding: '8px 10px',\n paddingTop: 0,\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-word',\n lineHeight: 1.4,\n userSelect: 'text',\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue, autorun } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport type { DaemonModel, DaemonScreenshotResult } from '../daemon/index.js';\n\ntype ScreenshotState =\n\t| { readonly status: 'idle' }\n\t| { readonly status: 'loading' }\n\t| { readonly status: 'ready'; readonly data: DaemonScreenshotResult }\n\t| { readonly status: 'error'; readonly message: string };\n\nclass FixtureScreenshotModel extends ViewModel({\n\tfixtureId: prop.const<string>(),\n\tsessionName: prop.const<string>(),\n\tdaemon: prop.const<DaemonModel>(),\n}) {\n\treadonly screenshot = observableValue<ScreenshotState>(this, { status: 'idle' });\n\tprivate _fetchVersion = 0;\n\n\tget fixtureId() { return this.props.fixtureId; }\n\n\tconstructor(props: any) {\n\t\tsuper(props);\n\t\tthis._store.add(autorun(reader => {\n\t\t\tconst sourceTreeIds = this.props.daemon.sourceTreeIds.read(reader);\n\t\t\tconst stId = sourceTreeIds.get(this.props.sessionName);\n\t\t\tif (stId) {\n\t\t\t\tthis._fetchScreenshot();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate async _fetchScreenshot(): Promise<void> {\n\t\tconst version = ++this._fetchVersion;\n\t\tthis.screenshot.set({ status: 'loading' }, undefined);\n\t\ttry {\n\t\t\tconst data = await this.props.daemon.getScreenshot(this.props.sessionName, this.props.fixtureId);\n\t\t\tif (version === this._fetchVersion) {\n\t\t\t\tthis.screenshot.set({ status: 'ready', data }, undefined);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (version === this._fetchVersion) {\n\t\t\t\tthis.screenshot.set({ status: 'error', message: String(e) }, undefined);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Displays a single screenshot from the daemon, with loading/error states.\n * Re-fetches automatically when the session's sourceTreeId changes.\n */\nexport const FixtureScreenshotView = viewWithModel(\n\tFixtureScreenshotModel,\n\t{},\n\t(reader, model) => {\n\t\tconst state = model.screenshot.read(reader);\n\n\t\tif (state.status === 'idle' || state.status === 'loading') {\n\t\t\treturn (\n\t\t\t\t<div style={screenshotStyles.placeholder}>\n\t\t\t\t\t<div style={screenshotStyles.shimmer} />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tif (state.status === 'error') {\n\t\t\treturn (\n\t\t\t\t<div style={screenshotStyles.error}>\n\t\t\t\t\t<span style={screenshotStyles.errorText}>Screenshot failed</span>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tconst { data } = state;\n\t\tif (!data.image) {\n\t\t\treturn (\n\t\t\t\t<div style={screenshotStyles.placeholder}>\n\t\t\t\t\t<span style={screenshotStyles.hashText}>{data.hash?.slice(0, 12)}</span>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<img\n\t\t\t\tsrc={`data:image/png;base64,${data.image}`}\n\t\t\t\tstyle={screenshotStyles.image}\n\t\t\t\talt={`Screenshot of ${model.fixtureId}`}\n\t\t\t/>\n\t\t);\n\t}\n);\n\nconst screenshotStyles = {\n\tplaceholder: {\n\t\tminHeight: 80,\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tjustifyContent: 'center',\n\t\tbackgroundColor: 'var(--component-explorer-editor-background)',\n\t\tborder: '1px solid var(--component-explorer-panel-border)',\n\t\tborderRadius: 4,\n\t\toverflow: 'hidden',\n\t} as React.CSSProperties,\n\tshimmer: {\n\t\twidth: '100%',\n\t\theight: 80,\n\t\tbackground: 'linear-gradient(90deg, var(--component-explorer-editor-background) 25%, var(--component-explorer-list-hoverBackground) 50%, var(--component-explorer-editor-background) 75%)',\n\t\tbackgroundSize: '200% 100%',\n\t\tanimation: 'shimmer 1.5s infinite',\n\t} as React.CSSProperties,\n\terror: {\n\t\tminHeight: 80,\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tjustifyContent: 'center',\n\t\tbackgroundColor: 'var(--component-explorer-inputValidation-errorBackground)',\n\t\tborder: '1px solid var(--component-explorer-inputValidation-errorBorder)',\n\t\tborderRadius: 4,\n\t} as React.CSSProperties,\n\terrorText: {\n\t\tfontSize: 12,\n\t\tcolor: 'var(--component-explorer-errorForeground)',\n\t} as React.CSSProperties,\n\thashText: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\tfontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n\t} as React.CSSProperties,\n\timage: {\n\t\tmaxWidth: '100%',\n\t\tdisplay: 'block',\n\t\tborderRadius: 4,\n\t\tborder: '1px solid var(--component-explorer-panel-border)',\n\t} as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue, autorun } from '@vscode/observables';\nimport { view, viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport type { DaemonModel } from '../daemon/index.js';\nimport type { ScreenshotComparisonItem } from './ExplorerModel.js';\nimport { FixtureScreenshotView } from './FixtureScreenshotView.js';\n\ntype ComparisonStatus =\n\t| { readonly status: 'loading' }\n\t| { readonly status: 'ready'; readonly match: boolean }\n\t| { readonly status: 'error'; readonly message: string };\n\n// ---------------------------------------------------------------------------\n// Single fixture comparison (current vs baseline side-by-side)\n// ---------------------------------------------------------------------------\n\nclass SingleComparisonModel extends ViewModel({\n\tfixtureId: prop.const<string>(),\n\tdaemon: prop.const<DaemonModel>(),\n\tbaselineSession: prop.const<string>(),\n\tcurrentSession: prop.const<string>(),\n}) {\n\treadonly comparisonStatus = observableValue<ComparisonStatus>(this, { status: 'loading' });\n\n\tget fixtureId() { return this.props.fixtureId; }\n\tget daemon() { return this.props.daemon; }\n\tget baselineSession() { return this.props.baselineSession; }\n\tget currentSession() { return this.props.currentSession; }\n\n\tconstructor(props: any) {\n\t\tsuper(props);\n\t\tthis._store.add(autorun(reader => {\n\t\t\tconst sourceTreeIds = this.props.daemon.sourceTreeIds.read(reader);\n\t\t\tconst baselineStId = sourceTreeIds.get(this.props.baselineSession);\n\t\t\tconst currentStId = sourceTreeIds.get(this.props.currentSession);\n\t\t\tif (baselineStId && currentStId) {\n\t\t\t\tthis._fetchComparison();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate async _fetchComparison(): Promise<void> {\n\t\tthis.comparisonStatus.set({ status: 'loading' }, undefined);\n\t\ttry {\n\t\t\tconst result = await this.props.daemon.compare(\n\t\t\t\tthis.props.fixtureId,\n\t\t\t\tthis.props.baselineSession,\n\t\t\t\tthis.props.currentSession,\n\t\t\t);\n\t\t\tthis.comparisonStatus.set({ status: 'ready', match: result.match }, undefined);\n\t\t} catch (e) {\n\t\t\tthis.comparisonStatus.set({ status: 'error', message: String(e) }, undefined);\n\t\t}\n\t}\n}\n\nconst SingleComparison = viewWithModel(\n\tSingleComparisonModel,\n\t{},\n\t(reader, model) => {\n\t\tconst status = model.comparisonStatus.read(reader);\n\n\t\tconst statusBadge = status.status === 'loading'\n\t\t\t? <span style={compStyles.badgeLoading}>comparing...</span>\n\t\t\t: status.status === 'error'\n\t\t\t\t? <span style={compStyles.badgeError}>error</span>\n\t\t\t\t: status.match\n\t\t\t\t\t? <span style={compStyles.badgeMatch}>✓ match</span>\n\t\t\t\t\t: <span style={compStyles.badgeChanged}>● changed</span>;\n\n\t\treturn (\n\t\t\t<div style={compStyles.fixtureRow}>\n\t\t\t\t<div style={compStyles.fixtureLabel}>\n\t\t\t\t\t<span style={compStyles.fixtureName}>{model.fixtureId}</span>\n\t\t\t\t\t{statusBadge}\n\t\t\t\t</div>\n\t\t\t\t<div style={compStyles.sideBySide}>\n\t\t\t\t\t<div style={compStyles.screenshotColumn}>\n\t\t\t\t\t\t<span style={compStyles.columnLabel}>Current</span>\n\t\t\t\t\t\t<FixtureScreenshotView\n\t\t\t\t\t\t\tfixtureId={model.fixtureId}\n\t\t\t\t\t\t\tsessionName={model.currentSession}\n\t\t\t\t\t\t\tdaemon={model.daemon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style={compStyles.screenshotColumn}>\n\t\t\t\t\t\t<span style={compStyles.columnLabel}>Baseline</span>\n\t\t\t\t\t\t<FixtureScreenshotView\n\t\t\t\t\t\t\tfixtureId={model.fixtureId}\n\t\t\t\t\t\t\tsessionName={model.baselineSession}\n\t\t\t\t\t\t\tdaemon={model.daemon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\n// ---------------------------------------------------------------------------\n// ScreenshotComparisonRow — renders a group of fixture comparisons\n// ---------------------------------------------------------------------------\n\nexport const ScreenshotComparisonRow = view(\n\t{\n\t\tname: prop.const<string>(),\n\t\tpath: prop.const<string>(),\n\t\titems: prop.const<readonly ScreenshotComparisonItem[]>(),\n\t\tdaemon: prop.const<DaemonModel>(),\n\t\tbaselineSession: prop.const<string>(),\n\t\tcurrentSession: prop.const<string>(),\n\t},\n\t(_reader, props) => {\n\t\treturn (\n\t\t\t<div style={compStyles.groupContent}>\n\t\t\t\t{props.items.map((item) => (\n\t\t\t\t\t<SingleComparison\n\t\t\t\t\t\tkey={item.fixtureId}\n\t\t\t\t\t\tfixtureId={item.fixtureId}\n\t\t\t\t\t\tdaemon={props.daemon}\n\t\t\t\t\t\tbaselineSession={props.baselineSession}\n\t\t\t\t\t\tcurrentSession={props.currentSession}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst compStyles = {\n\tgroupHeader: {\n\t\tmarginBottom: 12,\n\t} as React.CSSProperties,\n\tgroupTitle: {\n\t\tfontSize: 13,\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t} as React.CSSProperties,\n\tgroupContent: {\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'column',\n\t\tgap: 24,\n\t} as React.CSSProperties,\n\tfixtureRow: {\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'column',\n\t\tgap: 8,\n\t} as React.CSSProperties,\n\tfixtureLabel: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: 8,\n\t} as React.CSSProperties,\n\tfixtureName: {\n\t\tfontSize: 12,\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t} as React.CSSProperties,\n\tsideBySide: {\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'row',\n\t\tgap: 16,\n\t} as React.CSSProperties,\n\tscreenshotColumn: {\n\t\tflex: 1,\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'column',\n\t\tgap: 4,\n\t\tminWidth: 0,\n\t} as React.CSSProperties,\n\tcolumnLabel: {\n\t\tfontSize: 11,\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\ttextTransform: 'uppercase',\n\t\tletterSpacing: '0.05em',\n\t} as React.CSSProperties,\n\tbadgeMatch: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-testing-iconPassed)',\n\t\tfontWeight: 500,\n\t} as React.CSSProperties,\n\tbadgeChanged: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-testing-iconFailed)',\n\t\tfontWeight: 500,\n\t} as React.CSSProperties,\n\tbadgeLoading: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\tfontStyle: 'italic',\n\t} as React.CSSProperties,\n\tbadgeError: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-errorForeground)',\n\t\tfontWeight: 500,\n\t} as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { view, prop } from '@vscode/observables-react';\nimport type { ReportFixtureEntry } from '../report/ScreenshotReport.js';\nimport type { ReportModel } from '../report/ReportModel.js';\n\nexport interface ReportFixtureItem {\n readonly fixtureId: string;\n readonly name: string;\n readonly path: string;\n readonly entry: ReportFixtureEntry;\n}\n\n// ---------------------------------------------------------------------------\n// Checkered canvas (same as FixturePreviewItem)\n// ---------------------------------------------------------------------------\n\nconst CHECKER_SIZE = 8;\n\nfunction createCheckerPattern(baseColor: string, checkerColor: string): string {\n return `\n linear-gradient(45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(-45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, ${checkerColor} 75%),\n linear-gradient(-45deg, transparent 75%, ${checkerColor} 75%)\n `;\n}\n\nconst lightPattern = {\n backgroundColor: '#ffffff',\n backgroundImage: createCheckerPattern('#ffffff', '#e5e5e5'),\n};\n\nconst darkPattern = {\n backgroundColor: '#1e1e1e',\n backgroundImage: createCheckerPattern('#1e1e1e', '#2d2d2d'),\n};\n\nconst canvasBaseStyle: React.CSSProperties = {\n display: 'inline-block',\n padding: '12px',\n borderRadius: '4px',\n backgroundSize: `${CHECKER_SIZE * 2}px ${CHECKER_SIZE * 2}px`,\n backgroundPosition: `0 0, 0 ${CHECKER_SIZE}px, ${CHECKER_SIZE}px -${CHECKER_SIZE}px, -${CHECKER_SIZE}px 0`,\n boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)',\n};\n\nfunction getCanvasStyle(background: 'light' | 'dark'): React.CSSProperties {\n const pattern = background === 'dark' ? darkPattern : lightPattern;\n return {\n ...canvasBaseStyle,\n backgroundColor: pattern.backgroundColor,\n backgroundImage: pattern.backgroundImage,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Screenshot image (natural size, no scaling)\n// ---------------------------------------------------------------------------\n\nfunction ScreenshotImage({ src, alt, background }: {\n src: string;\n alt: string;\n background: 'light' | 'dark';\n}) {\n return (\n <div style={getCanvasStyle(background)}>\n <img src={src} alt={alt} style={styles.image} />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Single fixture comparison\n// ---------------------------------------------------------------------------\n\nconst ReportFixtureView = view(\n {\n item: prop.const<ReportFixtureItem>(),\n reportModel: prop.const<ReportModel>(),\n },\n (_reader, props) => {\n const { item, reportModel } = props;\n const { entry } = item;\n const background = entry.background ?? 'light';\n\n const statusBadge = entry.status === 'unchanged'\n ? <span style={styles.badgeMatch}>✓ match</span>\n : entry.status === 'changed'\n ? <span style={styles.badgeChanged}>● changed</span>\n : <span style={styles.badgeAdded}>+ added</span>;\n\n const hasScreenshots = entry.baselineScreenshot || entry.currentScreenshot;\n\n return (\n <div style={styles.fixtureRow}>\n <div style={styles.fixtureLabel}>\n <span style={styles.fixtureName}>{item.fixtureId}</span>\n {statusBadge}\n </div>\n {hasScreenshots && (\n <div style={styles.sideBySide}>\n {entry.baselineScreenshot && (\n <div style={styles.screenshotColumn}>\n <span style={styles.columnLabel}>Baseline</span>\n <ScreenshotImage\n src={reportModel.resolveScreenshotUrl(entry.baselineScreenshot)}\n alt={`Baseline screenshot of ${item.fixtureId}`}\n background={background}\n />\n </div>\n )}\n {entry.currentScreenshot && (\n <div style={styles.screenshotColumn}>\n <span style={styles.columnLabel}>Current</span>\n <ScreenshotImage\n src={reportModel.resolveScreenshotUrl(entry.currentScreenshot)}\n alt={`Current screenshot of ${item.fixtureId}`}\n background={background}\n />\n </div>\n )}\n </div>\n )}\n {!hasScreenshots && entry.status === 'unchanged' && (\n <div style={styles.hashRow}>\n <span style={styles.hashText}>hash: {entry.targetHash}</span>\n </div>\n )}\n </div>\n );\n }\n);\n\nexport const ReportComparisonRow = view(\n {\n name: prop.const<string>(),\n path: prop.const<string>(),\n items: prop.const<readonly ReportFixtureItem[]>(),\n reportModel: prop.const<ReportModel>(),\n },\n (_reader, props) => {\n return (\n <div style={styles.groupContent}>\n {props.items.map((item) => (\n <ReportFixtureView\n key={item.fixtureId}\n item={item}\n reportModel={props.reportModel}\n />\n ))}\n </div>\n );\n }\n);\n\nconst styles = {\n groupHeader: {\n marginBottom: 12,\n } as React.CSSProperties,\n groupTitle: {\n fontSize: 13,\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n groupContent: {\n display: 'flex',\n flexDirection: 'column',\n gap: 24,\n } as React.CSSProperties,\n fixtureRow: {\n display: 'flex',\n flexDirection: 'column',\n gap: 8,\n } as React.CSSProperties,\n fixtureLabel: {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n } as React.CSSProperties,\n fixtureName: {\n fontSize: 12,\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n sideBySide: {\n display: 'flex',\n flexDirection: 'row',\n gap: 16,\n } as React.CSSProperties,\n screenshotColumn: {\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n } as React.CSSProperties,\n columnLabel: {\n fontSize: 11,\n fontWeight: 500,\n color: 'var(--component-explorer-descriptionForeground)',\n textTransform: 'uppercase',\n letterSpacing: '0.05em',\n } as React.CSSProperties,\n image: {\n display: 'block',\n } as React.CSSProperties,\n hashRow: {\n padding: '8px 0',\n } as React.CSSProperties,\n hashText: {\n fontSize: 11,\n color: 'var(--component-explorer-descriptionForeground)',\n fontFamily: 'monospace',\n } as React.CSSProperties,\n badgeMatch: {\n fontSize: 11,\n color: 'var(--component-explorer-testing-iconPassed)',\n fontWeight: 500,\n } as React.CSSProperties,\n badgeChanged: {\n fontSize: 11,\n color: 'var(--component-explorer-testing-iconFailed)',\n fontWeight: 500,\n } as React.CSSProperties,\n badgeAdded: {\n fontSize: 11,\n color: 'var(--component-explorer-testing-iconQueued)',\n fontWeight: 500,\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue, derived } from '@vscode/observables';\nimport { view, viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport type { ExplorerModel, PreviewRow } from './ExplorerModel.js';\nimport { FixturePreviewItem } from './FixturePreviewItem.js';\nimport { buildQueryParamUrl } from '../lib/queryParamObservable.js';\nimport { ScreenshotComparisonRow } from './ScreenshotComparisonRow.js';\nimport { ReportComparisonRow } from './ReportComparisonRow.js';\nimport { getAllCachedHeights, setCachedHeight } from '../lib/fixtureSizeCache.js';\n\nconst ESTIMATED_ROW_HEIGHT = 280;\nconst ROW_GAP = 32;\nconst CONTENT_PADDING = 32;\nconst OVERSCAN_PX = 400;\n\n// ---------------------------------------------------------------------------\n// Scroll debug logging\n// ---------------------------------------------------------------------------\n\nconst logScroll = false;\nlet _scrollLogSeq = 0;\n\nfunction scrollLog(tag: string, data: Record<string, unknown>): void {\n if (!logScroll) return;\n const seq = ++_scrollLogSeq;\n const ts = performance.now().toFixed(1);\n console.log(\n `%c[scroll #${seq} @${ts}ms] ${tag}`,\n 'color: #3b82f6; font-weight: bold',\n data,\n );\n}\n\nfunction scrollWarn(tag: string, data: Record<string, unknown>): void {\n if (!logScroll) return;\n const seq = ++_scrollLogSeq;\n const ts = performance.now().toFixed(1);\n console.warn(\n `[scroll #${seq} @${ts}ms] ${tag}`,\n data,\n );\n}\n\nconst SCROLL_ANCHOR_KEY = 'component-explorer:scrollAnchors';\nconst MAX_ANCHOR_ENTRIES = 100;\n\n// ---------------------------------------------------------------------------\n// Scroll anchor persistence (row index + offset, not absolute scrollTop)\n// ---------------------------------------------------------------------------\n\ninterface ScrollAnchor {\n readonly rowIndex: number;\n readonly offsetFromViewport: number;\n}\n\nfunction loadScrollAnchors(): Record<string, ScrollAnchor> {\n try {\n const stored = localStorage.getItem(SCROLL_ANCHOR_KEY);\n if (stored) return JSON.parse(stored);\n } catch { /* ignore */ }\n return {};\n}\n\nfunction saveScrollAnchor(nodeId: string, anchor: ScrollAnchor): void {\n try {\n const all = loadScrollAnchors();\n all[nodeId] = anchor;\n const entries = Object.entries(all);\n const pruned = entries.length > MAX_ANCHOR_ENTRIES\n ? Object.fromEntries(entries.slice(-MAX_ANCHOR_ENTRIES))\n : all;\n localStorage.setItem(SCROLL_ANCHOR_KEY, JSON.stringify(pruned));\n } catch { /* ignore */ }\n}\n\nfunction getScrollAnchor(nodeId: string): ScrollAnchor | undefined {\n return loadScrollAnchors()[nodeId];\n}\n\n// ---------------------------------------------------------------------------\n// Layout computation (pure functions over data)\n// ---------------------------------------------------------------------------\n\ninterface RowLayout {\n readonly top: number;\n readonly height: number;\n}\n\nfunction getRowId(row: PreviewRow): string {\n return row.type === 'single' ? row.fixture.id : row.id;\n}\n\nfunction computeLayout(\n rows: readonly PreviewRow[],\n heightCache: ReadonlyMap<string, number>,\n): readonly RowLayout[] {\n const result: RowLayout[] = new Array(rows.length);\n let top = CONTENT_PADDING;\n for (let i = 0; i < rows.length; i++) {\n const height = heightCache.get(getRowId(rows[i])) ?? ESTIMATED_ROW_HEIGHT;\n result[i] = { top, height };\n top += height + ROW_GAP;\n }\n return result;\n}\n\nfunction layoutTotalHeight(layout: readonly RowLayout[]): number {\n if (layout.length === 0) return 0;\n const last = layout[layout.length - 1];\n return last.top + last.height + CONTENT_PADDING;\n}\n\n/** Binary search for first row whose bottom edge is >= y. */\nfunction findFirstVisibleRow(layout: readonly RowLayout[], y: number): number {\n let lo = 0;\n let hi = layout.length;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (layout[mid].top + layout[mid].height < y) {\n lo = mid + 1;\n } else {\n hi = mid;\n }\n }\n return lo;\n}\n\n/** Find visible row range for a given scrollTop + viewportHeight. */\nfunction computeVisibleRange(\n layout: readonly RowLayout[],\n scrollTop: number,\n viewportHeight: number,\n): { readonly start: number; readonly end: number } {\n if (layout.length === 0) return { start: 0, end: 0 };\n const start = findFirstVisibleRow(layout, scrollTop - OVERSCAN_PX);\n let end = start;\n const bottom = scrollTop + viewportHeight + OVERSCAN_PX;\n while (end < layout.length && layout[end].top < bottom) {\n end++;\n }\n return { start, end };\n}\n\n/** Find the row closest to the viewport top edge. */\nfunction computeAnchor(\n layout: readonly RowLayout[],\n scrollTop: number,\n): ScrollAnchor | undefined {\n if (layout.length === 0) return undefined;\n const idx = findFirstVisibleRow(layout, scrollTop);\n const rowIndex = Math.min(idx, layout.length - 1);\n return {\n rowIndex,\n offsetFromViewport: layout[rowIndex].top - scrollTop,\n };\n}\n\n/** Compute scrollTop to restore an anchor. */\nfunction scrollTopForAnchor(\n layout: readonly RowLayout[],\n anchor: ScrollAnchor,\n): number {\n if (anchor.rowIndex >= layout.length) return 0;\n return layout[anchor.rowIndex].top - anchor.offsetFromViewport;\n}\n\n// ---------------------------------------------------------------------------\n// Path headings\n// ---------------------------------------------------------------------------\n\nfunction getRowPath(row: PreviewRow): string {\n return row.type === 'single' ? row.fixture.path : row.path;\n}\n\nfunction getPathSegments(path: string): readonly string[] {\n return path.split(' / ').slice(1);\n}\n\ninterface HeadingInfo {\n readonly depth: number;\n readonly name: string;\n readonly nodeId: string;\n}\n\nfunction computeNewHeadings(\n current: readonly string[],\n previous: readonly string[] | undefined,\n rowId: string,\n): readonly HeadingInfo[] {\n const idSegments = rowId.split('/');\n const offset = idSegments.length - current.length;\n for (let i = 0; i < current.length; i++) {\n if (!previous || i >= previous.length || current[i] !== previous[i]) {\n return current.slice(i).map((name, j) => ({\n depth: i + j,\n name,\n nodeId: idSegments.slice(0, offset + i + j + 1).join('/'),\n }));\n }\n }\n return [];\n}\n\nconst headingTags = ['h1', 'h2', 'h3', 'h4'] as const;\n\nfunction headingTagForDepth(depth: number): (typeof headingTags)[number] {\n return headingTags[Math.min(depth, headingTags.length - 1)];\n}\n\nconst headingFontSizes = ['22px', '15px', '13px', '12px'];\n\nfunction headingStyleForDepth(depth: number): React.CSSProperties {\n return {\n fontSize: headingFontSizes[Math.min(depth, headingFontSizes.length - 1)],\n fontWeight: depth <= 1 ? 600 : 500,\n color: 'var(--component-explorer-foreground)',\n margin: 0,\n marginBottom: depth === 0 ? '8px' : '4px',\n paddingBottom: depth === 0 ? '6px' : undefined,\n borderBottom: depth === 0 ? '1px solid var(--component-explorer-widget-border, var(--component-explorer-panel-border, rgba(128,128,128,0.35)))' : undefined,\n };\n}\n\n// ---------------------------------------------------------------------------\n// PreviewAreaModel\n// ---------------------------------------------------------------------------\n\nclass PreviewAreaModel extends ViewModel({\n model: prop.const<ExplorerModel>(),\n}) {\n private readonly _rowHeights = observableValue<ReadonlyMap<string, number>>(this, getAllCachedHeights());\n private readonly _scrollTop = observableValue<number>(this, 0);\n private readonly _viewportHeight = observableValue<number>(this, 0);\n\n private _scrollContainerRef: HTMLDivElement | null = null;\n private _resizeObserver: ResizeObserver | null = null;\n private _viewportResizeObserver: ResizeObserver | null = null;\n private _currentNodeId: string | undefined = undefined;\n private _scrollSaveTimeout: ReturnType<typeof setTimeout> | null = null;\n private _suppressScrollHandler = false;\n\n get explorerModel() { return this.props.model; }\n\n get currentSessionName(): string {\n const daemon = this.explorerModel.daemon;\n if (!daemon) return 'current';\n const sessions = daemon.sessions.get();\n return sessions.find(s => s.sourceKind === 'current')?.name ?? sessions[0]?.name ?? 'current';\n }\n\n get baselineSessionName(): string {\n const daemon = this.explorerModel.daemon;\n if (!daemon) return 'baseline';\n const sessions = daemon.sessions.get();\n return sessions.find(s => s.sourceKind === 'worktree')?.name ?? sessions[1]?.name ?? 'baseline';\n }\n\n readonly layout = derived(this, (reader) => {\n const rows = this.explorerModel.selectedFixtures.read(reader);\n const heights = this._rowHeights.read(reader);\n return computeLayout(rows, heights);\n });\n\n readonly visibleRowRange = derived(this, (reader) => {\n const layout = this.layout.read(reader);\n const scrollTop = this._scrollTop.read(reader);\n const viewportHeight = this._viewportHeight.read(reader);\n return computeVisibleRange(layout, scrollTop, viewportHeight);\n });\n\n setScrollContainerRef = (el: HTMLDivElement | null): void => {\n if (this._scrollContainerRef) {\n this._scrollContainerRef.removeEventListener('scroll', this._handleScroll);\n }\n this._viewportResizeObserver?.disconnect();\n\n this._scrollContainerRef = el;\n if (!el) return;\n\n el.addEventListener('scroll', this._handleScroll, { passive: true });\n this._viewportHeight.set(el.clientHeight, undefined);\n scrollLog('setScrollContainerRef', { clientHeight: el.clientHeight, scrollTop: el.scrollTop });\n\n this._viewportResizeObserver = new ResizeObserver(([entry]) => {\n const h = Math.round(entry.contentRect.height);\n const prev = this._viewportHeight.get();\n if (h !== prev) {\n scrollLog('viewportResize', { prev, new: h });\n }\n this._viewportHeight.set(h, undefined);\n });\n this._viewportResizeObserver.observe(el);\n\n this._restoreScrollPosition();\n };\n\n updateForSelection(nodeId: string | undefined): void {\n if (this._currentNodeId === nodeId) return;\n scrollLog('updateForSelection', { prev: this._currentNodeId, new: nodeId });\n this._currentNodeId = nodeId;\n this._restoreScrollPosition();\n }\n\n private _restoreScrollPosition(): void {\n if (!this._scrollContainerRef || !this._currentNodeId) return;\n const anchor = getScrollAnchor(this._currentNodeId);\n if (!anchor) {\n scrollLog('restoreScroll:noAnchor', { nodeId: this._currentNodeId });\n return;\n }\n\n const layout = this.layout.get();\n const target = scrollTopForAnchor(layout, anchor);\n const prevScrollTop = this._scrollContainerRef.scrollTop;\n\n scrollLog('restoreScroll', {\n nodeId: this._currentNodeId,\n anchor,\n prevScrollTop,\n targetScrollTop: target,\n delta: target - prevScrollTop,\n layoutLength: layout.length,\n });\n\n this._suppressScrollHandler = true;\n this._scrollContainerRef.scrollTop = target;\n this._scrollTop.set(target, undefined);\n requestAnimationFrame(() => { this._suppressScrollHandler = false; });\n }\n\n private _handleScroll = (): void => {\n if (!this._scrollContainerRef) return;\n const prevObsScrollTop = this._scrollTop.get();\n const newScrollTop = this._scrollContainerRef.scrollTop;\n const delta = newScrollTop - prevObsScrollTop;\n this._scrollTop.set(newScrollTop, undefined);\n\n if (Math.abs(delta) > 200) {\n scrollWarn('handleScroll:LARGE_JUMP', {\n prevObsScrollTop,\n newScrollTop,\n delta,\n suppressed: this._suppressScrollHandler,\n stack: new Error().stack,\n });\n }\n\n if (this._suppressScrollHandler || !this._currentNodeId) {\n if (this._suppressScrollHandler) {\n scrollLog('handleScroll:suppressed', { newScrollTop, delta });\n }\n return;\n }\n if (this._scrollSaveTimeout) clearTimeout(this._scrollSaveTimeout);\n this._scrollSaveTimeout = setTimeout(() => {\n if (!this._currentNodeId) return;\n const layout = this.layout.get();\n const anchor = computeAnchor(layout, this._scrollTop.get());\n if (anchor) saveScrollAnchor(this._currentNodeId, anchor);\n }, 150);\n };\n\n observeRowElement = (el: HTMLDivElement | null, id: string): void => {\n if (!el) return;\n if (!this._resizeObserver) {\n this._resizeObserver = new ResizeObserver((entries) => {\n const current = this._rowHeights.get();\n let newMap: Map<string, number> | undefined;\n const changedRows: { rid: string; oldH: number | undefined; newH: number }[] = [];\n for (const entry of entries) {\n const rid = entry.target.getAttribute('data-row-id');\n if (!rid) continue;\n const height = Math.round(entry.contentRect.height);\n if (height > 0 && current.get(rid) !== height) {\n changedRows.push({ rid, oldH: current.get(rid), newH: height });\n if (!newMap) newMap = new Map(current);\n newMap.set(rid, height);\n setCachedHeight(rid, height);\n }\n }\n if (newMap) {\n const oldLayout = this.layout.get();\n const scrollTopBefore = this._scrollTop.get();\n const anchor = computeAnchor(oldLayout, scrollTopBefore);\n\n this._rowHeights.set(newMap, undefined);\n\n const newLayout = this.layout.get();\n\n if (anchor && this._scrollContainerRef) {\n const newScrollTop = scrollTopForAnchor(newLayout, anchor);\n const delta = newScrollTop - scrollTopBefore;\n\n if (Math.abs(delta) > 2) {\n scrollLog('resizeObserver:reAnchor', {\n changedRows,\n anchor,\n scrollTopBefore,\n newScrollTop,\n delta,\n oldTotalHeight: layoutTotalHeight(oldLayout),\n newTotalHeight: layoutTotalHeight(newLayout),\n });\n }\n if (Math.abs(delta) > 200) {\n scrollWarn('resizeObserver:LARGE_REANCHOR', {\n changedRows,\n anchor,\n scrollTopBefore,\n newScrollTop,\n delta,\n });\n }\n\n this._suppressScrollHandler = true;\n this._scrollContainerRef.scrollTop = newScrollTop;\n this._scrollTop.set(newScrollTop, undefined);\n requestAnimationFrame(() => { this._suppressScrollHandler = false; });\n }\n }\n });\n }\n el.setAttribute('data-row-id', id);\n this._resizeObserver.observe(el);\n };\n\n dispose(): void {\n this._resizeObserver?.disconnect();\n this._viewportResizeObserver?.disconnect();\n if (this._scrollContainerRef) {\n this._scrollContainerRef.removeEventListener('scroll', this._handleScroll);\n }\n if (this._scrollSaveTimeout) clearTimeout(this._scrollSaveTimeout);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Views\n// ---------------------------------------------------------------------------\n\nexport const PreviewArea = viewWithModel(\n PreviewAreaModel,\n {},\n (reader, model) => {\n const rows = model.explorerModel.selectedFixtures.read(reader);\n const selectedNodeId = model.explorerModel.selectedNodeId.read(reader);\n const layout = model.layout.read(reader);\n const { start, end } = model.visibleRowRange.read(reader);\n\n model.updateForSelection(selectedNodeId);\n\n if (rows.length === 0) {\n const reportModel = model.explorerModel.reportModel;\n if (reportModel) {\n const reportState = reportModel.state.read(reader);\n if (reportState.status === 'loading') {\n return (\n <div style={styles.emptyState}>\n <span style={styles.emptyText}>Loading report...</span>\n </div>\n );\n }\n if (reportState.status === 'error') {\n return (\n <div style={styles.emptyState}>\n <span style={{ ...styles.emptyText, color: 'var(--component-explorer-errorForeground)' }}>\n Failed to load report: {reportState.message}\n </span>\n </div>\n );\n }\n }\n return (\n <div style={styles.emptyState}>\n <span style={styles.emptyText}>Select a component or folder to preview</span>\n </div>\n );\n }\n\n const total = layoutTotalHeight(layout);\n\n return (\n <div ref={model.setScrollContainerRef} style={styles.scrollContainer}>\n <div style={{ position: 'relative', height: total }}>\n {rows.slice(start, end).map((row, i) => {\n const idx = start + i;\n const { top } = layout[idx];\n const id = getRowId(row);\n\n const currentSegments = getPathSegments(getRowPath(row));\n const prevSegments = idx > 0 ? getPathSegments(getRowPath(rows[idx - 1])) : undefined;\n const newHeadings = computeNewHeadings(currentSegments, prevSegments, id);\n\n return (\n <div\n key={id}\n ref={(el) => model.observeRowElement(el, id)}\n style={{ position: 'absolute', top, left: CONTENT_PADDING, right: CONTENT_PADDING }}\n >\n {newHeadings.map((h) => {\n const Tag = headingTagForDepth(h.depth);\n return (\n <Tag key={h.depth} style={headingStyleForDepth(h.depth)}>\n <a\n href={buildQueryParamUrl('fixture', h.nodeId)}\n style={styles.headingLink}\n onClick={(e) => { e.preventDefault(); model.explorerModel.selectNode(h.nodeId); }}\n >{h.name}</a>\n </Tag>\n );\n })}\n {row.type === 'single' ? (\n <FixturePreviewItem fixture={row.fixture} compact={false} onSelect={model.explorerModel.selectNode} />\n ) : row.type === 'variants' ? (\n <VariantsRowView row={row} onSelect={model.explorerModel.selectNode} />\n ) : row.type === 'screenshot-comparison' && model.explorerModel.daemon ? (\n <ScreenshotComparisonRow\n name={row.name}\n path={row.path}\n items={row.items}\n daemon={model.explorerModel.daemon}\n baselineSession={model.baselineSessionName}\n currentSession={model.currentSessionName}\n />\n ) : row.type === 'report-comparison' && model.explorerModel.reportModel ? (\n <ReportComparisonRow\n name={row.name}\n path={row.path}\n items={row.items}\n reportModel={model.explorerModel.reportModel}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n );\n }\n);\n\ntype VariantsRowData = Extract<PreviewRow, { type: 'variants' }>;\n\nconst VariantsRowView = view(\n {\n row: prop.const<VariantsRowData>(),\n onSelect: prop.const<(nodeId: string) => void>(),\n },\n (_reader, props) => {\n const row = props.row;\n return (\n <div style={styles.variantsContent}>\n {row.fixtures.map((fixture) => (\n <FixturePreviewItem key={fixture.id} fixture={fixture} compact onSelect={props.onSelect} />\n ))}\n </div>\n );\n }\n);\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst styles = {\n scrollContainer: {\n flex: 1,\n overflow: 'auto',\n backgroundColor: 'var(--component-explorer-editor-background)',\n } as React.CSSProperties,\n emptyState: {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: 'var(--component-explorer-editor-background)',\n } as React.CSSProperties,\n emptyText: {\n color: 'var(--component-explorer-descriptionForeground)',\n fontSize: '14px',\n } as React.CSSProperties,\n variantsHeader: {\n marginBottom: '12px',\n } as React.CSSProperties,\n variantsTitle: {\n fontSize: '13px',\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n variantsContent: {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n gap: '16px',\n } as React.CSSProperties,\n headingLink: {\n textDecoration: 'none',\n color: 'inherit',\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { ConsoleEventsStore, type ConsoleEvent } from '../core/ConsoleEventsStore.js';\n\nclass ConsolePanelModel extends ViewModel({\n\tstore: prop.const<ConsoleEventsStore>(),\n}) {\n\treadonly expanded = observableValue(this, false);\n\n\tget store(): ConsoleEventsStore { return this.props.store; }\n\n\ttoggleExpanded(): void {\n\t\tthis.expanded.set(!this.expanded.get(), undefined);\n\t}\n\n\tclear(): void {\n\t\tthis.store.clear();\n\t}\n}\n\nexport const ConsolePanel = viewWithModel(\n\tConsolePanelModel,\n\t{ store: prop.const<ConsoleEventsStore>() },\n\t(reader, model) => {\n\t\tconst store = model.store;\n\t\tconst events = store.events.read(reader);\n\t\tconst errorCount = store.errorCount.read(reader);\n\t\tconst expanded = model.expanded.read(reader);\n\n\t\tif (events.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<div style={panelStyles.container}>\n\t\t\t\t<button\n\t\t\t\t\tstyle={panelStyles.header}\n\t\t\t\t\tonClick={() => model.toggleExpanded()}\n\t\t\t\t>\n\t\t\t\t\t<span style={panelStyles.headerLeft}>\n\t\t\t\t\t\t<span style={panelStyles.chevron}>{expanded ? '▼' : '▶'}</span>\n\t\t\t\t\t\t<span>Console</span>\n\t\t\t\t\t\t{errorCount > 0 && (\n\t\t\t\t\t\t\t<span style={panelStyles.errorBadge}>{errorCount}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{events.length > errorCount && (\n\t\t\t\t\t\t\t<span style={panelStyles.warnBadge}>{events.length - errorCount}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\tstyle={panelStyles.clearButton}\n\t\t\t\t\t\tonClick={(e) => { e.stopPropagation(); model.clear(); }}\n\t\t\t\t\t\ttitle=\"Clear console\"\n\t\t\t\t\t>\n\t\t\t\t\t\tClear\n\t\t\t\t\t</button>\n\t\t\t\t</button>\n\t\t\t\t{expanded && (\n\t\t\t\t\t<div style={panelStyles.content}>\n\t\t\t\t\t\t{events.map((event: ConsoleEvent) => (\n\t\t\t\t\t\t\t<ConsoleEventRow key={event.id} event={event} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nfunction ConsoleEventRow({ event }: { event: ConsoleEvent }): React.ReactElement {\n\tconst [showStack, setShowStack] = React.useState(false);\n\tconst isError = event.type === 'console.error' || event.type === 'window.error' || event.type === 'window.unhandledrejection';\n\tconst isWarn = event.type === 'console.warn';\n\n\tconst time = new Date(event.timestamp);\n\tconst timeStr = time.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\t...rowStyles.container,\n\t\t\t\tbackgroundColor: isError ? 'rgba(255, 80, 80, 0.1)' : isWarn ? 'rgba(255, 200, 0, 0.1)' : 'transparent',\n\t\t\t\tborderLeft: `3px solid ${isError ? '#f55' : isWarn ? '#fc0' : 'transparent'}`,\n\t\t\t}}\n\t\t>\n\t\t\t<span style={rowStyles.time}>{timeStr}</span>\n\t\t\t<span style={{ ...rowStyles.type, color: isError ? '#f77' : isWarn ? '#fc0' : '#888' }}>\n\t\t\t\t{event.type.replace('window.', '').replace('console.', '')}\n\t\t\t</span>\n\t\t\t<span style={rowStyles.message}>\n\t\t\t\t{event.message}\n\t\t\t\t{event.stack && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={rowStyles.stackIndicator}\n\t\t\t\t\t\tonClick={() => setShowStack(!showStack)}\n\t\t\t\t\t\ttitle=\"Toggle stack trace\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{showStack ? ' ▴' : ' ▾'}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t\t{showStack && event.stack && (\n\t\t\t\t<pre style={rowStyles.stack}>{event.stack}</pre>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nconst panelStyles = {\n\tcontainer: {\n\t\tborderTop: '1px solid var(--component-explorer-panel-border)',\n\t\tbackgroundColor: 'var(--component-explorer-editor-background)',\n\t\tflexShrink: 0,\n\t} as React.CSSProperties,\n\theader: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tjustifyContent: 'space-between',\n\t\twidth: '100%',\n\t\tpadding: '6px 12px',\n\t\tbackgroundColor: 'var(--component-explorer-sideBar-background)',\n\t\tborder: 'none',\n\t\tcursor: 'pointer',\n\t\tfontSize: '12px',\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t\tfontFamily: 'inherit',\n\t} as React.CSSProperties,\n\theaderLeft: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: '8px',\n\t} as React.CSSProperties,\n\tchevron: {\n\t\tfontSize: '10px',\n\t\topacity: 0.7,\n\t} as React.CSSProperties,\n\terrorBadge: {\n\t\tbackgroundColor: '#f55',\n\t\tcolor: '#fff',\n\t\tfontSize: '10px',\n\t\tfontWeight: 600,\n\t\tpadding: '1px 6px',\n\t\tborderRadius: '10px',\n\t\tminWidth: '18px',\n\t\ttextAlign: 'center',\n\t} as React.CSSProperties,\n\twarnBadge: {\n\t\tbackgroundColor: '#a80',\n\t\tcolor: '#fff',\n\t\tfontSize: '10px',\n\t\tfontWeight: 600,\n\t\tpadding: '1px 6px',\n\t\tborderRadius: '10px',\n\t\tminWidth: '18px',\n\t\ttextAlign: 'center',\n\t} as React.CSSProperties,\n\tclearButton: {\n\t\tpadding: '2px 8px',\n\t\tfontSize: '11px',\n\t\tbackgroundColor: 'transparent',\n\t\tborder: '1px solid var(--component-explorer-button-border)',\n\t\tborderRadius: '3px',\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t\tcursor: 'pointer',\n\t\tfontFamily: 'inherit',\n\t} as React.CSSProperties,\n\tcontent: {\n\t\tmaxHeight: '200px',\n\t\toverflowY: 'auto',\n\t\tuserSelect: 'text',\n\t\tcursor: 'text',\n\t} as React.CSSProperties,\n};\n\nconst rowStyles = {\n\tcontainer: {\n\t\tdisplay: 'grid',\n\t\tgridTemplateColumns: 'auto auto 1fr',\n\t\tgap: '8px',\n\t\tpadding: '4px 12px',\n\t\tfontSize: '12px',\n\t\tfontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n\t\tborderBottom: '1px solid var(--component-explorer-panel-border)',\n\t} as React.CSSProperties,\n\ttime: {\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\topacity: 0.7,\n\t} as React.CSSProperties,\n\ttype: {\n\t\tfontWeight: 500,\n\t\tminWidth: '80px',\n\t} as React.CSSProperties,\n\tmessage: {\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t\twordBreak: 'break-word',\n\t} as React.CSSProperties,\n\tstackIndicator: {\n\t\tfontSize: '10px',\n\t\topacity: 0.5,\n\t\tcursor: 'pointer',\n\t\tuserSelect: 'none',\n\t} as React.CSSProperties,\n\tstack: {\n\t\tgridColumn: '1 / -1',\n\t\tmargin: '4px 0 0 0',\n\t\tpadding: '8px',\n\t\tbackgroundColor: 'rgba(0, 0, 0, 0.2)',\n\t\tborderRadius: '4px',\n\t\tfontSize: '11px',\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\twhiteSpace: 'pre-wrap',\n\t\twordBreak: 'break-word',\n\t\tlineHeight: 1.4,\n\t} as React.CSSProperties,\n};\n","import { viewWithModel, prop } from '@vscode/observables-react';\nimport { ExplorerModel } from './ExplorerModel.js';\nimport { TitleBar } from './TitleBar.js';\nimport { LeftSidebar } from './LeftSidebar.js';\nimport { RightSidebar } from './RightSidebar.js';\nimport { PreviewArea } from './PreviewArea.js';\nimport { ConsolePanel } from './ConsolePanel.js';\nimport { ConsoleEventsStore } from '../core/ConsoleEventsStore.js';\nimport { styles } from './styles.js';\nimport type { DaemonModel } from '../daemon/index.js';\nimport type { ReportModel } from '../report/ReportModel.js';\n\n// Install global console events capture\nconst consoleEventsStore = ConsoleEventsStore.getInstance();\nconsoleEventsStore.install();\n\nconst loadingStyle: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '12px',\n height: '100%',\n width: '100%',\n color: 'var(--component-explorer-foreground)',\n opacity: 0.5,\n fontSize: '13px',\n};\n\nconst spinnerStyle: React.CSSProperties = {\n width: '24px',\n height: '24px',\n border: '2px solid currentColor',\n borderTopColor: 'transparent',\n borderRadius: '50%',\n animation: 'explorer-spin 0.8s linear infinite',\n};\n\nexport const Explorer = viewWithModel(\n ExplorerModel,\n { daemonModel: prop.const<DaemonModel | undefined>(), reportModel: prop.const<ReportModel | undefined>() },\n (reader, model) => {\n const isDarkTheme = model.isDarkTheme.read(reader);\n const loading = model.loading.read(reader);\n const error = model.error.read(reader);\n\n const themeClass = isDarkTheme ? 'vscode-theme default-dark-plus' : 'vscode-theme default-light-plus';\n\n if (error) {\n return (\n <div className={themeClass} style={{ ...styles.container, backgroundColor: 'var(--component-explorer-editor-background)' }}>\n <div style={{ ...loadingStyle, userSelect: 'text', cursor: 'text' }}>\n <span style={{ color: 'var(--component-explorer-errorForeground)' }}>Failed to load fixtures</span>\n <pre style={{ fontSize: '12px', opacity: 0.7, whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0, fontFamily: 'inherit' }}>{error}</pre>\n </div>\n </div>\n );\n }\n\n if (loading) {\n return (\n <div className={themeClass} style={{ ...styles.container, backgroundColor: 'var(--component-explorer-editor-background)' }}>\n <style>{`@keyframes explorer-spin { to { transform: rotate(360deg); } }`}</style>\n <div style={loadingStyle}>\n <div style={spinnerStyle} />\n Loading fixtures…\n </div>\n </div>\n );\n }\n\n const leftVisible = model.leftSidebarVisible.read(reader);\n const rightVisible = model.rightSidebarVisible.read(reader);\n const selectedNode = model.selectedNode.read(reader);\n\n return (\n <div className={themeClass} style={styles.container}>\n {leftVisible && <LeftSidebar model={model} />}\n <div style={styles.centerArea}>\n <TitleBar model={model} />\n <PreviewArea model={model} />\n <ConsolePanel store={consoleEventsStore} />\n </div>\n {rightVisible && <RightSidebar selectedNode={selectedNode} />}\n </div>\n );\n }\n);\n","// src/AsyncStream.ts\nvar AsyncStream = class _AsyncStream {\n constructor(iterator) {\n this.iterator = iterator;\n }\n static fromIterable(fn) {\n return new _AsyncStream(fn[Symbol.asyncIterator]());\n }\n static fromFn(fn) {\n return new _AsyncStream(fn());\n }\n [Symbol.asyncIterator]() {\n return this.iterator;\n }\n};\nvar MediaResponse = class {\n constructor(mimeType, data) {\n this.mimeType = mimeType;\n this.data = data;\n }\n};\n\nexport {\n AsyncStream,\n MediaResponse\n};\n//# sourceMappingURL=chunk-SGBCNXYH.mjs.map","import {\n AsyncStream\n} from \"./chunk-SGBCNXYH.mjs\";\n\n// src/client.ts\nvar ApiError = class extends Error {\n constructor(statusCode, method, message) {\n super(message);\n this.statusCode = statusCode;\n this.method = method;\n this.name = \"ApiError\";\n }\n};\nvar ProxyApiClient = class {\n constructor(_request) {\n this._request = _request;\n }\n _createProxy(prefix) {\n return new Proxy(() => {\n }, {\n apply: async (_target, _self, args) => {\n const result = await this._request(prefix, args[0]);\n return result;\n },\n get: (_target, prop) => {\n if (typeof prop === \"symbol\") {\n return void 0;\n }\n if (prop === \"then\" || prop === \"catch\" || prop === \"finally\" || prop === \"toString\" || prop === \"valueOf\" || prop === \"toJSON\" || prop === \"name\" || prop === \"length\" || prop === \"prototype\" || prop === \"constructor\" || prop === \"caller\" || prop === \"arguments\") {\n return void 0;\n }\n return this._createProxy(`${prefix}${prefix ? \"/\" : \"\"}${prop}`);\n }\n });\n }\n methods = this._createProxy(\"\");\n};\nfunction createFetchClient(baseUrl, options) {\n return new ProxyApiClient(async (method, arg) => {\n const result = await fetch(`${baseUrl}/${method}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.getHeaders?.()\n },\n body: JSON.stringify(arg)\n });\n if (result.status !== 200) {\n const data2 = await result.json().catch(() => null);\n let message;\n if (data2 && typeof data2 === \"object\" && (\"errorMessage\" in data2 || \"error\" in data2)) {\n const msg = data2.errorMessage ?? data2.error;\n const stack = data2.stack;\n message = `${msg}${stack ? `\n${stack}` : \"\"}`;\n } else {\n message = `Error calling API method \"${method}\" (${result.status}): ${JSON.stringify(data2)}`;\n }\n const error = new ApiError(result.status, method, message);\n options?.onError?.(error);\n throw error;\n }\n const contentType = result.headers.get(\"Content-Type\");\n if (contentType?.startsWith(\"application/jsonl\")) {\n return AsyncStream.fromFn(async function* () {\n const reader = result.body?.getReader();\n if (!reader) {\n return;\n }\n let buffer = \"\";\n const decoder = new TextDecoder(\"utf-8\");\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n buffer += decoder.decode(value, { stream: true });\n let eolIndex;\n while ((eolIndex = buffer.indexOf(\"\\n\")) >= 0) {\n const line = buffer.slice(0, eolIndex).trim();\n buffer = buffer.slice(eolIndex + 1);\n if (line.length > 0) {\n yield JSON.parse(line);\n }\n }\n }\n const finalLine = buffer.trim();\n if (finalLine.length > 0) {\n yield JSON.parse(finalLine);\n }\n });\n }\n const data = await result.json();\n return data;\n });\n}\nfunction createLocalClient(api, context) {\n return new ProxyApiClient(async (method, args) => {\n return await api.run(method, args, context);\n });\n}\n\nexport {\n ApiError,\n ProxyApiClient,\n createFetchClient,\n createLocalClient\n};\n//# sourceMappingURL=chunk-TAEFVNPN.mjs.map","import { observableValue, type IObservable } from '@vscode/observables';\nimport { createFetchClient, type ProxyApiClient } from '@hediet/simple-api/client';\nimport { SemanticVersion } from 'semver';\nimport {\n type DaemonApiType,\n type DaemonEvent,\n} from '@vscode/component-explorer-cli/daemon-types';\nimport type { DaemonConfig } from './DaemonConfig.js';\nimport { runtimeVersion } from '../runtimeVersion.js';\n\n/** Screenshot result from the daemon */\nexport type DaemonScreenshotResult = DaemonApiType['screenshots']['take']['TResult'];\n\n/** Comparison result from the daemon */\nexport type DaemonCompareResult = DaemonApiType['screenshots']['compare']['TResult'];\n\n/** Fixture info from the daemon */\nexport type DaemonFixtureInfo = DaemonApiType['fixtures']['list']['TResult']['fixtures'][number];\n\nexport interface DaemonSession {\n\treadonly name: string;\n\treadonly serverUrl: string;\n\treadonly sourceKind: 'current' | 'worktree';\n}\n\ninterface CachedScreenshot {\n\treadonly sourceTreeId: string;\n\treadonly data: DaemonScreenshotResult;\n}\n\n/**\n * Client-side model for interacting with the daemon.\n * Manages source tree IDs, screenshot caching, and the event stream.\n */\nexport class DaemonModel {\n\tprivate readonly _sourceTreeIds = observableValue<ReadonlyMap<string, string>>(this, new Map());\n\tprivate readonly _sessions = observableValue<readonly DaemonSession[]>(this, []);\n\tprivate readonly _screenshotCache = new Map<string, CachedScreenshot>();\n\tprivate readonly _client: ProxyApiClient<DaemonApiType>;\n\tprivate _eventStreamAbort: AbortController | null = null;\n\n\treadonly sessionName: string;\n\n\t/** Observable map of sessionName → current sourceTreeId */\n\treadonly sourceTreeIds: IObservable<ReadonlyMap<string, string>> = this._sourceTreeIds;\n\n\t/** Observable list of sessions from the daemon */\n\treadonly sessions: IObservable<readonly DaemonSession[]> = this._sessions;\n\n\tconstructor(readonly config: DaemonConfig) {\n\t\tthis.sessionName = config.sessionName;\n\t\tthis._client = createFetchClient<DaemonApiType>('/__explorer/daemon-api', {\n\t\t\tgetHeaders: () => ({ 'X-Client-Name': 'explorer-ui' }),\n\t\t});\n\t}\n\n\t/**\n\t * Initializes the model: fetches initial session info and starts listening to events.\n\t * Call this once after construction.\n\t */\n\tasync initialize(): Promise<void> {\n\t\tthis._validateProtocolVersions();\n\t\tawait this._fetchSessionInfos();\n\t\tthis._startEventStream();\n\t}\n\n\t/**\n\t * Get a screenshot for a fixture in a session, using cache when available.\n\t * Cache is keyed on sessionName + fixtureId and invalidated when sourceTreeId changes.\n\t */\n\tasync getScreenshot(sessionName: string, fixtureId: string): Promise<DaemonScreenshotResult> {\n\t\tconst sourceTreeId = this._sourceTreeIds.get().get(sessionName);\n\t\tif (!sourceTreeId) {\n\t\t\tthrow new Error(`No sourceTreeId known for session '${sessionName}'`);\n\t\t}\n\n\t\tconst cacheKey = `${sessionName}:${fixtureId}`;\n\t\tconst cached = this._screenshotCache.get(cacheKey);\n\t\tif (cached && cached.sourceTreeId === sourceTreeId) {\n\t\t\treturn cached.data;\n\t\t}\n\n\t\tconst result = await this._client.methods.screenshots.take({\n\t\t\tfixtureId,\n\t\t\tsessionName,\n\t\t\tsourceTreeId,\n\t\t\tincludeImage: true,\n\t\t});\n\n\t\tthis._screenshotCache.set(cacheKey, { sourceTreeId, data: result });\n\t\treturn result;\n\t}\n\n\t/**\n\t * Compare a fixture across two sessions. Returns match status and hashes (no images).\n\t */\n\tasync compare(fixtureId: string, baselineSessionName: string, currentSessionName: string): Promise<DaemonCompareResult> {\n\t\tconst baselineSourceTreeId = this._sourceTreeIds.get().get(baselineSessionName);\n\t\tconst currentSourceTreeId = this._sourceTreeIds.get().get(currentSessionName);\n\t\tif (!baselineSourceTreeId || !currentSourceTreeId) {\n\t\t\tthrow new Error(`Missing sourceTreeId for sessions`);\n\t\t}\n\t\treturn this._client.methods.screenshots.compare({\n\t\t\tfixtureId,\n\t\t\tbaselineSessionName,\n\t\t\tbaselineSourceTreeId,\n\t\t\tcurrentSessionName,\n\t\t\tcurrentSourceTreeId,\n\t\t\tincludeImages: false,\n\t\t});\n\t}\n\n\t/**\n\t * List fixtures from a session.\n\t */\n\tasync listFixtures(sessionName: string): Promise<readonly DaemonFixtureInfo[]> {\n\t\tconst sourceTreeId = this._sourceTreeIds.get().get(sessionName);\n\t\tif (!sourceTreeId) {\n\t\t\tthrow new Error(`No sourceTreeId known for session '${sessionName}'`);\n\t\t}\n\t\tconst result = await this._client.methods.fixtures.list({ sessionName, sourceTreeId });\n\t\treturn result.fixtures;\n\t}\n\n\t/**\n\t * Get the explorer URL for a different session (for session switching via full navigation).\n\t */\n\tgetSessionExplorerUrl(sessionName: string): string | undefined {\n\t\tconst session = this._sessions.get().find(s => s.name === sessionName);\n\t\tif (!session) return undefined;\n\t\treturn session.serverUrl + '/___explorer';\n\t}\n\n\tdispose(): void {\n\t\tthis._eventStreamAbort?.abort();\n\t\tthis._eventStreamAbort = null;\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Private\n\t// ---------------------------------------------------------------------------\n\n\tprivate async _fetchSessionInfos(): Promise<void> {\n\t\tconst sessions = await this._client.methods.sessions();\n\t\tconst map = new Map<string, string>();\n\t\tconst sessionList: DaemonSession[] = [];\n\t\tfor (const s of sessions) {\n\t\t\tif (s.isLoading) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmap.set(s.name, s.sourceTreeId);\n\t\t\tsessionList.push({ name: s.name, serverUrl: s.serverUrl, sourceKind: s.sourceKind });\n\t\t}\n\t\tthis._sourceTreeIds.set(map, undefined);\n\t\tthis._sessions.set(sessionList, undefined);\n\t}\n\n\tprivate async _startEventStream(): Promise<void> {\n\t\tthis._eventStreamAbort = new AbortController();\n\t\tconst signal = this._eventStreamAbort.signal;\n\n\t\ttry {\n\t\t\tconst stream = await this._client.methods.events();\n\t\t\tfor await (const event of stream) {\n\t\t\t\tif (signal.aborted) break;\n\t\t\t\tthis._handleEvent(event as DaemonEvent);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!signal.aborted) {\n\t\t\t\tconsole.error('[DaemonModel] Event stream error:', e);\n\t\t\t\t// Reconnect after a delay\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (!signal.aborted) {\n\t\t\t\t\t\tthis._startEventStream();\n\t\t\t\t\t}\n\t\t\t\t}, 2000);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _handleEvent(event: DaemonEvent): void {\n\t\tif (event.type === 'source-change') {\n\t\t\t// Update sourceTreeId for the session\n\t\t\tconst current = new Map(this._sourceTreeIds.get());\n\t\t\tcurrent.set(event.sessionName, event.sourceTreeId);\n\t\t\tthis._sourceTreeIds.set(current, undefined);\n\n\t\t\t// Evict screenshot cache entries for this session\n\t\t\tfor (const key of this._screenshotCache.keys()) {\n\t\t\t\tif (key.startsWith(`${event.sessionName}:`)) {\n\t\t\t\t\tthis._screenshotCache.delete(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _validateProtocolVersions(): void {\n\t\tconst expectedDaemonApiVersion = SemanticVersion.parse('1.0.0');\n\t\tconst actualDaemonApiVersion = SemanticVersion.parse(this.config.daemonApiVersion);\n\t\tif (expectedDaemonApiVersion.major !== actualDaemonApiVersion.major || expectedDaemonApiVersion.minor !== actualDaemonApiVersion.minor) {\n\t\t\tthrow new Error(\n\t\t\t\t`Daemon API version mismatch. Explorer expects 1.0.0, daemon provides ${this.config.daemonApiVersion}. Update CLI, vite plugin, and explorer together.`,\n\t\t\t);\n\t\t}\n\n\t\tconst neededByPlugin = SemanticVersion.parse(this.config.runtimeVersionNeededByPlugin);\n\t\tif (neededByPlugin.major !== runtimeVersion.major || neededByPlugin.minor !== runtimeVersion.minor) {\n\t\t\tthrow new Error(\n\t\t\t\t`Explorer runtime version mismatch. Plugin requires ${this.config.runtimeVersionNeededByPlugin}, explorer provides ${runtimeVersion.toString()}. Reinstall dependencies to align plugin and explorer runtime versions.`,\n\t\t\t);\n\t\t}\n\t}\n}\n","import { IReader, observableValue } from '@vscode/observables';\nimport type { ScreenshotReport, ReportFixtureEntry } from './ScreenshotReport.js';\nimport type { ExplorerTreeNode } from '../components/types.js';\nimport { FixturePath } from '../core/FixturePath.js';\n\ntype ReportState =\n | { readonly status: 'loading' }\n | { readonly status: 'ready'; readonly report: ScreenshotReport }\n | { readonly status: 'error'; readonly message: string };\n\nexport class ReportModel {\n readonly state = observableValue<ReportState>(this, { status: 'loading' });\n\n private readonly _baseUrl: string;\n\n constructor(readonly reportUrl: string) {\n // Base URL = everything up to and including the last '/'\n const lastSlash = reportUrl.lastIndexOf('/');\n this._baseUrl = lastSlash >= 0 ? reportUrl.slice(0, lastSlash + 1) : '';\n this._fetch();\n }\n\n resolveScreenshotUrl(relativePath: string): string {\n return this._baseUrl + relativePath;\n }\n\n buildTree(reader: IReader): ExplorerTreeNode {\n const state = this.state.read(reader);\n if (state.status !== 'ready') {\n return { id: new FixturePath(''), name: 'Report', type: 'folder', children: [], labels: [] };\n }\n\n return buildTreeFromFixtureIds(state.report.fixtures);\n }\n\n private async _fetch(): Promise<void> {\n this.state.set({ status: 'loading' }, undefined);\n try {\n const response = await fetch(this.reportUrl);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n const report: ScreenshotReport = await response.json();\n this.state.set({ status: 'ready', report }, undefined);\n } catch (e) {\n this.state.set({ status: 'error', message: String(e) }, undefined);\n }\n }\n}\n\ninterface MutableTreeNode {\n id: FixturePath;\n name: string;\n type: 'folder' | 'component';\n children?: MutableTreeNode[];\n reportEntry?: ReportFixtureEntry;\n labels: string[];\n}\n\nfunction buildTreeFromFixtureIds(fixtures: { readonly [fixtureId: string]: ReportFixtureEntry | undefined }): ExplorerTreeNode {\n const root: MutableTreeNode = { id: new FixturePath(''), name: 'Components', type: 'folder', children: [], labels: [] };\n\n for (const [fixtureId, entry] of Object.entries(fixtures)) {\n const segments = new FixturePath(fixtureId).segments;\n let current = root;\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n const isLeaf = i === segments.length - 1;\n const childId = new FixturePath(segments.slice(0, i + 1).join('/'));\n\n if (isLeaf) {\n const labels = [...(entry?.labels ?? [])];\n if (entry?.status === 'changed' && !labels.includes('changed')) {\n labels.push('changed');\n }\n current.children!.push({\n id: childId,\n name: segment,\n type: 'component',\n reportEntry: entry,\n labels,\n });\n } else {\n let folder = current.children!.find(c => c.type === 'folder' && c.name === segment);\n if (!folder) {\n folder = { id: childId, name: segment, type: 'folder', children: [], labels: [] };\n current.children!.push(folder);\n }\n current = folder;\n }\n }\n }\n\n return root;\n}\n","import { createRoot } from 'react-dom/client';\nimport { createElement } from 'react';\nimport { FixtureRegistry, type FixtureExport, type FixtureModules, type ExplorerRuntime } from '../core/index.js';\nimport { Explorer } from '../components/index.js';\nimport { DaemonModel } from '../daemon/index.js';\nimport type { DaemonConfig } from '../daemon/DaemonConfig.js';\nimport { ReportModel } from '../report/index.js';\nimport { setExplorerShadowHost } from '../lib/explorerShadowHost.js';\n\nimport explorerCss from '../styles.css?inline';\nimport darkThemeCss from '../vscode-styles/default-dark-plus.css?inline';\nimport lightThemeCss from '../vscode-styles/default-light-plus.css?inline';\n\nexport class ExplorerUIMode implements ExplorerRuntime {\n\tprivate readonly _root: ReturnType<typeof createRoot>;\n\tprivate readonly _registry = new FixtureRegistry();\n\tprivate readonly _daemonModel?: DaemonModel;\n\tprivate readonly _reportModel?: ReportModel;\n\n\tconstructor(element: HTMLElement, loadFixtures: Promise<FixtureModules>, daemonConfig?: DaemonConfig) {\n\t\tthis._registry.loading.set(true, undefined);\n\t\tloadFixtures.then(\n\t\t\tmodules => {\n\t\t\t\tthis._populateRegistry(modules);\n\t\t\t\tthis._registry.loading.set(false, undefined);\n\t\t\t\tthis._registry.error.set(undefined, undefined);\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tconst message = error instanceof Error ? (error.stack ?? error.message) : String(error);\n\t\t\t\tthis._registry.loading.set(false, undefined);\n\t\t\t\tthis._registry.error.set(message, undefined);\n\t\t\t},\n\t\t);\n\t\tthis._reportModel = this._initializeReportModel();\n\t\tthis._daemonModel = this._reportModel ? undefined : this._initializeDaemonModel(daemonConfig);\n\n\t\tconst shadow = element.attachShadow({ mode: 'open' });\n\t\tconst sheet = new CSSStyleSheet();\n\t\tsheet.replaceSync([explorerCss, darkThemeCss, lightThemeCss].join('\\n'));\n\t\tshadow.adoptedStyleSheets = [sheet];\n\n\t\tsetExplorerShadowHost(element);\n\n\t\tconst uiContainer = document.createElement('div');\n\t\tuiContainer.style.height = '100%';\n\t\tuiContainer.style.width = '100%';\n\t\tshadow.appendChild(uiContainer);\n\n\t\tthis._root = createRoot(uiContainer);\n\t\tthis._root.render(createElement(Explorer, {\n\t\t\tregistry: this._registry,\n\t\t\tdaemonModel: this._daemonModel,\n\t\t\treportModel: this._reportModel,\n\t\t}));\n\t}\n\n\tprivate _initializeReportModel(): ReportModel | undefined {\n\t\tconst params = new URLSearchParams(location.search);\n\t\tconst reportUrl = params.get('report');\n\t\tif (!reportUrl) return undefined;\n\t\treturn new ReportModel(reportUrl);\n\t}\n\n\tprivate _initializeDaemonModel(daemonConfig: DaemonConfig | undefined): DaemonModel | undefined {\n\t\tif (!daemonConfig) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst model = new DaemonModel(daemonConfig);\n\t\tmodel.initialize().catch(err => {\n\t\t\tconsole.error('[ExplorerUIMode] Failed to initialize DaemonModel:', err);\n\t\t});\n\t\treturn model;\n\t}\n\n\tprivate _populateRegistry(fixtureModules: FixtureModules): void {\n\t\tthis._registry.clear();\n\t\tfor (const [path, module] of Object.entries(fixtureModules)) {\n\t\t\tconst fixture = module.default;\n\t\t\tif (fixture && typeof fixture === 'object') {\n\t\t\t\tthis._registry.register(path, fixture as FixtureExport);\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateFixtures(fixtureModules: FixtureModules): void {\n\t\tthis._populateRegistry(fixtureModules);\n\t\tthis._registry.loading.set(false, undefined);\n\t\tthis._registry.error.set(undefined, undefined);\n\t}\n\n\tbumpVersion(): void {}\n\n\tdispose(): void {\n\t\tthis._daemonModel?.dispose();\n\t\tthis._root.unmount();\n\t}\n}\n","import type { FixtureNode } from '../core/FixtureNode.js';\nimport type { FixtureExport } from '../core/fixtureApi.js';\nimport type { ExceptionError, RenderEvent, RenderReport } from '../core/ErrorInfo.js';\nimport type { ExplorerRuntime, FixtureModules } from '../core/index.js';\nimport type { HeadlessApi, HeadlessFlatFixture, IComponentExplorerGlobal } from '@vscode/component-explorer-common';\nimport { createFixtureTree } from '../core/FixtureNode.js';\nimport { ComponentRendering } from '../core/ComponentRenderer.js';\nimport { runtimeVersion } from '../runtimeVersion.js';\n\ndeclare global {\n\tinterface Window extends IComponentExplorerGlobal {}\n}\n\nconst globalSetTimeout = window.setTimeout;\n\nexport class HeadlessMode implements ExplorerRuntime {\n\t/** Random ID generated on construction — changes on full page reload. */\n\treadonly pageInstanceId = Math.random().toString(36).slice(2);\n\tprivate _updateVersion = 0;\n\tprivate _root: FixtureNode;\n\tprivate _fixtureModules: FixtureModules;\n\tprivate _loadError: string | undefined;\n\tprivate _loadPromise: Promise<void>;\n\tprivate _currentRendering: ComponentRendering | undefined;\n\tprivate _currentContainer: HTMLElement | undefined;\n\n\tconstructor(\n\t\tprivate readonly _containerElement: HTMLElement,\n\t\tloadFixtures: Promise<FixtureModules>,\n\t) {\n\t\tthis._fixtureModules = {};\n\t\tthis._root = this._buildTree(this._fixtureModules);\n\t\tthis._loadPromise = loadFixtures.then(\n\t\t\tmodules => {\n\t\t\t\tthis._fixtureModules = modules;\n\t\t\t\tthis._root = this._buildTree(modules);\n\t\t\t\tthis._loadError = undefined;\n\t\t\t\tthis._updateVersion++;\n\t\t\t\tconst count = this._flattenFixtures(this._root).length;\n\t\t\t\tconsole.log('[headless] Fixtures loaded, version:', this._updateVersion, 'fixtures:', count);\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tthis._loadError = error instanceof Error ? (error.stack ?? error.message) : String(error);\n\t\t\t\tthis._updateVersion++;\n\t\t\t\tconsole.error('[headless] Failed to load fixtures:', this._loadError);\n\t\t\t},\n\t\t);\n\t\tthis._installGlobalApi();\n\n\t\tconsole.log('[headless] Initialized, pageInstanceId:', this.pageInstanceId);\n\t}\n\n\tget updateVersion(): number {\n\t\treturn this._updateVersion;\n\t}\n\n\tupdateFixtures(fixtureModules: FixtureModules): void {\n\t\tthis._fixtureModules = fixtureModules;\n\t\tthis._root = this._buildTree(fixtureModules);\n\t\tthis._loadError = undefined;\n\t\tthis._updateVersion++;\n\t\tconst count = this._flattenFixtures(this._root).length;\n\t\tconsole.log('[headless] Registry rebuilt, version:', this._updateVersion, 'fixtures:', count);\n\t}\n\n\tbumpVersion(): void {\n\t\tthis._updateVersion++;\n\t\tconsole.log('[headless] Version bumped:', this._updateVersion);\n\t}\n\n\tasync listFixtures(): Promise<HeadlessFlatFixture[]> {\n\t\tawait this._loadPromise;\n\t\tif (this._loadError) {\n\t\t\tthrow new Error(this._loadError);\n\t\t}\n\t\treturn this._flattenFixtures(this._root);\n\t}\n\n\tdisposeCurrentFixture(): void {\n\t\tif (this._currentRendering) {\n\t\t\tthis._currentRendering.dispose();\n\t\t\tthis._currentRendering = undefined;\n\t\t}\n\t\tif (this._currentContainer) {\n\t\t\tthis._currentContainer.remove();\n\t\t\tthis._currentContainer = undefined;\n\t\t}\n\t}\n\n\tasync renderFixture(fixtureId: string): Promise<RenderReport> {\n\t\tawait this._loadPromise;\n\t\tif (this._loadError) {\n\t\t\tthrow new Error(this._loadError);\n\t\t}\n\t\tconst node = this._findFixtureNode(this._root, fixtureId);\n\t\tif (!node || !node.component) {\n\t\t\tthrow new Error('Fixture not found: ' + fixtureId);\n\t\t}\n\n\t\tthis.disposeCurrentFixture();\n\n\t\tconst container = document.createElement('div');\n\t\tcontainer.style.display = 'inline-block';\n\t\tthis._containerElement.appendChild(container);\n\t\tthis._currentContainer = container;\n\n\t\tconst def = node.component;\n\n\t\tconst events: RenderEvent[] = [];\n\t\tlet error: ExceptionError | undefined;\n\n\t\tconst setError = (e: ExceptionError) => {\n\t\t\tif (!error) { error = e; }\n\t\t};\n\n\t\tconst originalError = console.error;\n\t\tconst originalWarn = console.warn;\n\t\tconst originalLog = console.log;\n\t\tconsole.error = (...args: unknown[]) => {\n\t\t\tevents.push({ type: 'console.error', message: args.map(String).join(' ') });\n\t\t\toriginalError.apply(console, args);\n\t\t};\n\t\tconsole.warn = (...args: unknown[]) => {\n\t\t\tevents.push({ type: 'console.warn', message: args.map(String).join(' ') });\n\t\t\toriginalWarn.apply(console, args);\n\t\t};\n\t\tconsole.log = (...args: unknown[]) => {\n\t\t\tevents.push({ type: 'console.log', message: args.map(String).join(' ') });\n\t\t\toriginalLog.apply(console, args);\n\t\t};\n\n\t\tconst errorHandler = (event: ErrorEvent) => {\n\t\t\tevents.push({ type: 'window.error', message: event.message });\n\t\t};\n\t\tconst rejectionHandler = (event: PromiseRejectionEvent) => {\n\t\t\tconst reason = event.reason;\n\t\t\tconst message = reason instanceof Error ? reason.message : String(reason);\n\t\t\tevents.push({ type: 'window.unhandledrejection', message });\n\t\t};\n\t\twindow.addEventListener('error', errorHandler);\n\t\twindow.addEventListener('unhandledrejection', rejectionHandler);\n\n\t\tlet resultData: unknown;\n\t\tconst startTime = performance.now();\n\t\tlet syncTimeMs: number | undefined;\n\t\ttry {\n\t\t\tconst rendering = new ComponentRendering(container, def);\n\t\t\tsyncTimeMs = performance.now() - startTime;\n\t\t\tthis._currentRendering = rendering;\n\n\t\t\tconst TIMEOUT_MS = 3000;\n\t\t\tconst renderTimeout = new Promise<never>((_, reject) => \n\t\t\t\tglobalSetTimeout(() => reject(new Error(`Fixture timed out after ${TIMEOUT_MS}ms`)), TIMEOUT_MS)\n\t\t\t);\n\t\t\tconst result = await Promise.race([rendering.waitForRendering(), renderTimeout]);\n\t\t\tresultData = result?.data;\n\t\t} catch (e) {\n\t\t\tif (e instanceof Error) {\n\t\t\t\tsetError({ message: e.message, stack: e.stack });\n\t\t\t} else if (e && typeof e === 'object' && 'message' in e) {\n\t\t\t\tsetError({ message: String((e as Record<string, unknown>).message), stack: String((e as Record<string, unknown>).stack ?? '') || undefined });\n\t\t\t} else {\n\t\t\t\tsetError({ message: String(e) });\n\t\t\t}\n\t\t} finally {\n\t\t\tconsole.error = originalError;\n\t\t\tconsole.warn = originalWarn;\n\t\t\tconsole.log = originalLog;\n\t\t}\n\n\t\tif (!error) {\n\t\t\tawait new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));\n\t\t}\n\n\t\tconst totalTimeMs = performance.now() - startTime;\n\n\t\twindow.removeEventListener('error', errorHandler);\n\t\twindow.removeEventListener('unhandledrejection', rejectionHandler);\n\n\t\tconst hasError = !!error || events.some(e => e.type !== 'console.log' && e.type !== 'console.warn');\n\t\tconst renderTimeMs = { sync: Math.round(syncTimeMs ?? totalTimeMs), total: Math.round(totalTimeMs) };\n\t\treturn { hasError, error, events, resultData, renderTimeMs };\n\t}\n\n\tprivate _buildTree(fixtureModules: FixtureModules): FixtureNode {\n\t\tconst fixtures = new Map<string, FixtureExport>();\n\t\tfor (const [path, module] of Object.entries(fixtureModules)) {\n\t\t\tconst fixture = module.default;\n\t\t\tif (fixture && typeof fixture === 'object') {\n\t\t\t\tfixtures.set(path, fixture as FixtureExport);\n\t\t\t}\n\t\t}\n\t\treturn createFixtureTree(fixtures);\n\t}\n\n\tprivate _flattenFixtures(node: FixtureNode, groupPath: string[] = [], inheritedLabels: readonly string[] = []): HeadlessFlatFixture[] {\n\t\tconst effectiveLabels = inheritedLabels.length > 0 && node.labels.length > 0\n\t\t\t? [...new Set([...inheritedLabels, ...node.labels])]\n\t\t\t: node.labels.length > 0 ? [...node.labels]\n\t\t\t: [...inheritedLabels];\n\t\tconst results: HeadlessFlatFixture[] = [];\n\t\tif (node.type === 'component') {\n\t\t\tresults.push({ fixtureId: node.id.value, fixtureName: node.name, groupPath, background: node.component?.background ?? 'light', labels: effectiveLabels, expectedVisualDescriptions: node.component?.expectedVisualDescriptions ?? [] });\n\t\t}\n\t\tfor (const child of node.children ?? []) {\n\t\t\tconst nextPath = node.id.value ? [...groupPath, node.name] : groupPath;\n\t\t\tresults.push(...this._flattenFixtures(child, nextPath, effectiveLabels));\n\t\t}\n\t\treturn results;\n\t}\n\n\tprivate _findFixtureNode(node: FixtureNode, fixtureId: string): FixtureNode | undefined {\n\t\tif (node.id.value === fixtureId) return node;\n\t\tfor (const child of node.children ?? []) {\n\t\t\tconst found = this._findFixtureNode(child, fixtureId);\n\t\t\tif (found) return found;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate _installGlobalApi(): void {\n\t\tconst self = this;\n\t\tconst api: HeadlessApi = {\n\t\t\tpageInstanceId: this.pageInstanceId,\n\t\t\tget updateVersion() { return self._updateVersion; },\n\t\t\truntimeVersion: runtimeVersion.toString(),\n\t\t\tlistFixtures: () => this.listFixtures(),\n\t\t\trenderFixture: (id) => this.renderFixture(id),\n\t\t\tdisposeCurrentFixture: () => this.disposeCurrentFixture(),\n\t\t};\n\t\twindow.__componentExplorer__ = api;\n\t}\n}\n","import type { FixtureExport } from '../core/fixtureApi.js';\nimport type { FixtureNode } from '../core/FixtureNode.js';\nimport type { ExplorerRuntime, FixtureModules } from '../core/index.js';\nimport type { ExceptionError, RenderEventType } from '../core/ErrorInfo.js';\nimport { createFixtureTree } from '../core/FixtureNode.js';\nimport { ComponentRendering } from '../core/ComponentRenderer.js';\n\nexport class EmbeddedMode implements ExplorerRuntime {\n\tprivate _root: FixtureNode | undefined;\n\tprivate _rendering: ComponentRendering | undefined;\n\tprivate _resizeObserver: ResizeObserver | undefined;\n\tprivate _errorPosted = false;\n\tprivate _originalConsoleError: typeof console.error | undefined;\n\tprivate _originalConsoleWarn: typeof console.warn | undefined;\n\n\tconstructor(\n\t\tprivate readonly _container: HTMLElement,\n\t\tprivate readonly _fixtureId: string,\n\t\tloadSourceModule: Promise<FixtureModules>,\n\t) {\n\t\tthis._setupErrorCapture();\n\t\tloadSourceModule.then(\n\t\t\tmodules => {\n\t\t\t\tthis._root = this._buildTree(modules);\n\t\t\t\tthis._render();\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tconst message = error instanceof Error ? (error.stack ?? error.message) : String(error);\n\t\t\t\tconsole.error('[EmbeddedMode] Failed to load fixtures:', message);\n\t\t\t\tthis._container.innerHTML = '';\n\t\t\t\tconst el = document.createElement('div');\n\t\t\t\tel.style.cssText = 'padding:16px;color:#f44;font-size:13px;font-family:monospace;white-space:pre-wrap;user-select:text;cursor:text;';\n\t\t\t\tel.textContent = `Failed to load fixture:\\n${message}`;\n\t\t\t\tthis._container.appendChild(el);\n\t\t\t\tthis._postError({ message: error instanceof Error ? error.message : String(error), stack: error instanceof Error ? error.stack : undefined });\n\t\t\t},\n\t\t);\n\t}\n\n\tprivate _setupErrorCapture(): void {\n\t\t// Intercept console.error and forward to parent\n\t\tthis._originalConsoleError = console.error;\n\t\tconsole.error = (...args: unknown[]) => {\n\t\t\tthis._postConsoleEvent('console.error', args.map(String).join(' '));\n\t\t\tthis._originalConsoleError!.apply(console, args);\n\t\t};\n\n\t\t// Intercept console.warn and forward to parent\n\t\tthis._originalConsoleWarn = console.warn;\n\t\tconsole.warn = (...args: unknown[]) => {\n\t\t\tthis._postConsoleEvent('console.warn', args.map(String).join(' '));\n\t\t\tthis._originalConsoleWarn!.apply(console, args);\n\t\t};\n\n\t\twindow.addEventListener('error', (event) => {\n\t\t\tthis._postError({ message: event.message, stack: event.error?.stack });\n\t\t\tthis._postConsoleEvent('window.error', event.message, event.error?.stack);\n\t\t});\n\t\twindow.addEventListener('unhandledrejection', (event) => {\n\t\t\tconst reason = event.reason;\n\t\t\tconst message = reason instanceof Error ? reason.message : String(reason);\n\t\t\tconst stack = reason instanceof Error ? reason.stack : undefined;\n\t\t\tthis._postError({ message, stack });\n\t\t\tthis._postConsoleEvent('window.unhandledrejection', message, stack);\n\t\t});\n\t}\n\n\tprivate _postConsoleEvent(type: RenderEventType, message: string, stack?: string): void {\n\t\twindow.parent.postMessage({\n\t\t\ttype: 'component-explorer:console',\n\t\t\teventType: type,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t}, '*');\n\t}\n\n\tprivate _postError(error: ExceptionError): void {\n\t\tif (this._errorPosted) return;\n\t\tthis._errorPosted = true;\n\t\twindow.parent.postMessage({\n\t\t\ttype: 'component-explorer:error',\n\t\t\tfixtureId: this._fixtureId,\n\t\t\terror,\n\t\t}, '*');\n\t}\n\n\tupdateFixtures(fixtureModules: FixtureModules): void {\n\t\tthis._root = this._buildTree(fixtureModules);\n\t\tthis._render();\n\t}\n\n\tbumpVersion(): void {\n\t\tthis._render();\n\t}\n\n\tprivate _render(): void {\n\t\tthis._rendering?.dispose();\n\t\tthis._rendering = undefined;\n\t\tthis._resizeObserver?.disconnect();\n\t\tthis._resizeObserver = undefined;\n\t\tthis._container.innerHTML = '';\n\n\t\tif (!this._root) return;\n\n\t\tconst node = this._findNode(this._root, this._fixtureId);\n\t\tif (!node?.component) {\n\t\t\tconsole.error(`[EmbeddedMode] Fixture not found: ${this._fixtureId}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst component = { ...node.component, isolation: 'none' as const };\n\t\tthis._errorPosted = false;\n\n\t\ttry {\n\t\t\tconst rendering = new ComponentRendering(this._container, component);\n\t\t\tthis._rendering = rendering;\n\n\t\t\trendering.waitForRendering().catch((err) => {\n\t\t\t\tif (err && typeof err === 'object' && 'message' in err) {\n\t\t\t\t\tthis._postError(err as ExceptionError);\n\t\t\t\t} else {\n\t\t\t\t\tthis._postError({ message: err instanceof Error ? err.message : String(err), stack: err instanceof Error ? err.stack : undefined });\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (err) {\n\t\t\t// Catch sync errors thrown during render\n\t\t\tthis._postError({ message: err instanceof Error ? err.message : String(err), stack: err instanceof Error ? err.stack : undefined });\n\t\t\tconsole.error('[EmbeddedMode] Error during rendering:', err);\n\t\t\treturn;\n\t\t}\n\n\t\tconst rendering = this._rendering;\n\t\tconst fixtureId = this._fixtureId;\n\t\tconst postSize = () => {\n\t\t\tconst rect = rendering.renderTarget.getBoundingClientRect();\n\t\t\twindow.parent.postMessage({\n\t\t\t\ttype: 'component-explorer:resize',\n\t\t\t\tfixtureId,\n\t\t\t\twidth: rect.width,\n\t\t\t\theight: rect.height,\n\t\t\t}, '*');\n\t\t};\n\n\t\tthis._resizeObserver = new ResizeObserver(postSize);\n\t\tthis._resizeObserver.observe(rendering.renderTarget);\n\t}\n\n\tprivate _buildTree(fixtureModules: FixtureModules): FixtureNode {\n\t\tconst fixtures = new Map<string, FixtureExport>();\n\t\tfor (const [path, module] of Object.entries(fixtureModules)) {\n\t\t\tconst fixture = module.default;\n\t\t\tif (fixture && typeof fixture === 'object') {\n\t\t\t\tfixtures.set(path, fixture as FixtureExport);\n\t\t\t}\n\t\t}\n\t\treturn createFixtureTree(fixtures);\n\t}\n\n\tprivate _findNode(node: FixtureNode, id: string): FixtureNode | undefined {\n\t\tif (node.id.value === id) return node;\n\t\tfor (const child of node.children ?? []) {\n\t\t\tconst found = this._findNode(child, id);\n\t\t\tif (found) return found;\n\t\t}\n\t\treturn undefined;\n\t}\n}\n","import type { ExplorerQueryParams } from '@vscode/component-explorer-cli/explorer-types';\nexport type { ExplorerMode, ExplorerQueryParams } from '@vscode/component-explorer-cli/explorer-types';\n\nexport function parseExplorerQueryParams(params: URLSearchParams): ExplorerQueryParams {\n const mode = params.get('mode');\n return {\n mode: mode === 'headless' || mode === 'embedded' ? mode : undefined,\n fixture: params.get('fixture') ?? undefined,\n file: params.get('file') ?? undefined,\n report: params.get('report') ?? undefined,\n };\n}\n\nexport function toUrlSearchParams(query: ExplorerQueryParams): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) params.set(key, String(value));\n }\n return params;\n}\n","/**\n * Viewer entry point\n * \n * This module exports everything needed by the Component Explorer viewer.\n * Projects should NOT import from this module - use '@vscode/component-explorer' instead.\n */\n\nexport * from './core/index.js';\n\nexport type {\n FixtureExport,\n SingleFixtureExport,\n FixtureGroupExport,\n FixtureVariantsExport,\n} from './core/fixtureApi.js';\n\nimport { type FixtureModules, type ExplorerRuntime } from './core/index.js';\nimport { ExplorerUIMode } from './modes/ExplorerUIMode.js';\nimport { HeadlessMode } from './modes/HeadlessMode.js';\nimport { EmbeddedMode } from './modes/EmbeddedMode.js';\nimport { parseExplorerQueryParams, type ExplorerQueryParams } from './lib/explorerQueryParams.js';\nimport type { DaemonConfig } from './daemon/DaemonConfig.js';\n\nexport type { ExplorerMode, ExplorerQueryParams } from './lib/explorerQueryParams.js';\n\n// Main exports\nexport { Explorer, ExplorerModel } from './components/index.js';\nexport type { ExplorerTreeNode } from './components/index.js';\nexport { toExplorerTree } from './components/index.js';\n\n// Sub-components\nexport {\n TitleBar,\n TitleBarButton,\n LeftSidebar,\n RightSidebar,\n TreeView,\n TreeItem,\n} from './components/index.js';\n\n// Icons\nexport * from './components/icons.js';\n\n// Styles utilities\nexport { styles, mergeStyles } from './components/index.js';\n\n// Daemon exports\nexport { DaemonModel } from './daemon/index.js';\nexport type { DaemonScreenshotResult, DaemonCompareResult, DaemonFixtureInfo } from './daemon/DaemonModel.js';\n\n// Report exports\nexport { ReportModel } from './report/index.js';\nexport type { ScreenshotReport, ReportFixtureEntry, ReportSummary, FixtureStatus } from './report/index.js';\n\nexport interface ExplorerAppOptions {\n readonly loadFixtures: (filter?: { file: string }) => Promise<FixtureModules>;\n readonly daemonConfig?: DaemonConfig;\n}\n\nexport class ExplorerApp implements ExplorerRuntime {\n private readonly _runtime: ExplorerRuntime;\n\n constructor(element: HTMLElement, options: ExplorerAppOptions) {\n const buildInfo = globalThis._buildInfo;\n if (buildInfo) {\n console.log(`[component-explorer] v${buildInfo.version} (built ${buildInfo.date})`);\n }\n\n const params = new URLSearchParams(location.search);\n const query: ExplorerQueryParams = parseExplorerQueryParams(params);\n const fixtureId = query.fixture;\n\n if (query.mode === 'embedded') {\n if (!fixtureId) {\n throw new Error('Embedded mode requires a fixture query parameter');\n }\n const file = query.file;\n const fixtures = options.loadFixtures(file ? { file } : undefined);\n this._runtime = new EmbeddedMode(element, fixtureId, fixtures);\n } else {\n const fixturesPromise = options.loadFixtures();\n this._runtime = query.mode === 'headless'\n ? new HeadlessMode(element, fixturesPromise)\n : new ExplorerUIMode(element, fixturesPromise, options.daemonConfig);\n }\n }\n\n updateFixtures(fixtureModules: FixtureModules): void {\n this._runtime.updateFixtures(fixtureModules);\n }\n\n bumpVersion(): void {\n this._runtime.bumpVersion();\n }\n}\n"],"names":["isSingleFixture","value","singleFixtureBrand","isFixtureGroup","fixtureGroupBrand","isFixtureVariants","fixtureVariantsBrand","parseFixtureExport","parseSingleFixture","parseFixtureGroup","parseFixtureVariants","createComponentDefinition","fixture","id","name","sourceFile","inheritedVisualDescriptions","options","ownDescriptions","expectedVisualDescriptions","isComponentDefinition","FixturePath","__publicField","VIEWPORT_SIZES","resolveViewport","preset","validatePath","path","computePathSegments","filePath","pathOption","baseName","extractBaseName","prefix","createFixtureTree","fixtures","root","fixtureExport","skeletonNode","segments","addFixtureExportToTree","parent","pathSegments","pathPrefix","current","accumulatedPath","i","folderName","folderId","folder","_a","c","finalSegment","fullId","def","componentNode","_b","key","entry","own","ownArr","groupVisualDescriptions","variantsNode","variant","variantVisualDescriptions","childId","findNodeByPath","segment","collectComponents","node","components","child","globalObservableLogger","addLogger","logger","ComposedLogger","getLogger","globalObservableLoggerFn","setLogObservableFn","fn","logObservable","obs","loggers","observable","location","newCount","info","autorun","change","derived","transaction","DebugLocation","enabled","enable","ofCaller","ofNthCaller","n","Err","l","stack","DebugLocationImpl","parentIdx","lines","parseLine","fileName","line","column","stackLine","match","match2","DebugNameData","owner","debugNameSource","referenceFn","target","getDebugName","countPerName","cachedDebugName","data","cached","dbgName","computeDebugName","count","result","self","ownerStr","formatOwner","getFunctionName","findKey","obj","countPerClassName","ownerId","className","getClassName","ctor","fnSrc","_derived","_setDerivedOpts","_recomputeInitiallyAndOnChange","_setRecomputeInitiallyAndOnChange","recomputeInitiallyAndOnChange","_keepObserved","_setKeepObserved","keepObserved","_debugGetDependencyGraph","_setDebugGetDependencyGraph","debugGetDependencyGraph","ConvenientObservable","reader","fnOrOwner","fnOrUndefined","debugLocation","store","handleValue","BaseObservable","observer","len","deleted","hadLogger","toDisposable","BugIndicatingError","message","onBugIndicatingError","error","onUnexpectedError","strictEquals","a","b","DisposableStore","disposable","index","derivedStateToString","state","Derived","_debugNameData","_computeFn","_changeTracker","_handleLastObserverRemoved","_equalityComparator","d","changeSummary","didChange","emptySet","_c","hadValue","oldValue","delayedStore","o","_d","e","r","_observable","propagateBeginUpdate","observers","shouldReact","wasUpToDate","shouldCallBeginUpdate","newValue","tx","computeFnOrOwner","computeFn","derivedOpts","derivedDisposable","computeFnOrUndefined","autorunStateToString","AutorunObserver","_runFn","handleBugIndicatingErrorRecovery","err","TransactionImpl","subtransaction","_fn","_getDebugName","updatingObservers","observableValue","nameOrOwner","initialValue","debugNameData","ObservableValue","_tx","observableFromEvent","args","event","getValue","FromEventObservable","_getValue","_getTransaction","didRunTransaction","batchEventsGlobally","didSet","KeepAliveObserver","_forceRecompute","_handleValue","consoleObservableLogger","logObservableToConsole","ConsoleObservableLogger","text","consoleTextToArgs","normalText","repeat","styled","formatValue","formatKind","changes","changedObservables","transactionName","styles","firstArg","process","t","item","kind","padStr","objToCss","styleObj","styleString","propName","propValue","style","availableLen","formatValueUnsafe","formatArray","formatObject","first","val","entries","str","length","debugNamePostProcessor","Info","formatObservableInfo","indentLevel","alreadyListed","indent","dep","sourceObj","type","dependencies","FixtureRegistry","tree","ManualChangesHandler","_run","_change","prop","PropertyTransformerFactory","propConst","PropertyConstTransformerFactory","propObs","PropertyObsTransformerFactory","readableProp","_reader","v","isObservable","mapObject","ViewModelContextSymbol","BaseViewModel","props","getOrCreateViewModelContext","createContext","ViewModel","renderingCount","batchedUpdater","potentialChanges","rendering","unstable_batchedUpdates","viewIdx","ViewImpl","debugName","renderFactory","obsView","componentName","render","contexts","plusOne","x","createVM","forceUpdate","useReducer","useState","ctx","useContext","useEffect","view","p","readableProps","propValues","collectRequiredContexts","propsDesc","viewWithModel","viewModelCtor","propsOrRender","maybeRender","modelPropsDesc","requiredContexts","viewModelContext","allContexts","getContextValues","contextValues","providedModel","readableModelProps","k","model","modelProps","m","toExplorerTree","nodeMatches","lowerQuery","label","filterTree","query","filterNode","selfMatches","filteredChildren","filtered","createLocalStorageObservable","storageKey","defaultValue","serialize","deserialize","stored","originalSet","createQueryParamObservable","paramName","search","newUrl","buildQueryParamUrl","ExplorerModel","report","nodeId","selectedNode","mode","sessionName","daemon","url","newSet","selected","parts","expanded","nodes","found","childPath","items","reportState","mergeStyles","styleObjects","TitleBarButtonModel","hovered","TitleBarButton","isHovered","active","buttonStyle","jsx","ChevronRightIcon","ChevronDownIcon","ComponentIcon","FolderIcon","PanelLeftIcon","PanelRightIcon","SunIcon","MoonIcon","ViewModeSelector","viewMode","sessions","currentSession","otherSessions","s","jsxs","viewModeStyles","ViewModeButton","onClick","TitleBar","leftVisible","rightVisible","isDarkTheme","Fragment","labelContainerStyle","countFixtures","sum","labelBadgeStyle","TreeView","TreeItem","TreeItemModel","itemModel","depth","hasChildren","isExpanded","isSelected","itemStyle","searchContainerStyle","searchInputStyle","searchWrapperStyle","clearButtonStyle","SearchInput","LeftSidebar","ToggleSwitchModel","ToggleSwitch","checked","trackStyle","thumbStyle","PropertiesContent","RightSidebar","MAX_ENTRIES","createHeightCache","_cache","load","save","height","_rowHeights","_contentHeights","setCachedHeight","fixtureId","getAllCachedHeights","setCachedContentHeight","getCachedContentHeight","_nextEventId","_ConsoleEventsStore","reason","ConsoleEventsStore","injectStyles","targetDoc","injectedElements","adoptedSheets","appendTarget","styleEl","linkEl","removeStyles","el","sheet","ComponentRendering","host","component","isolation","shadowRoot","iframe","rejectRendered","onMessage","_","reject","rawResult","resolved","_shadowHost","setExplorerShadowHost","getExplorerShadowHost","_fixtureContainers","_originalFocus","isInsideFixtureContainer","registerFixtureContainer","container","_nextSlotId","FixturePreviewItemModel","shadowHost","fixtureContainer","displayMode","viewport","width","FixturePreviewItem","measuredWidth","measuredHeight","compact","dimensionsText","wrapperStyle","previewItemStyles","nameStyle","getCanvasStyle","FixtureError","CHECKER_SIZE","createCheckerPattern","baseColor","checkerColor","lightPattern","darkPattern","canvasBaseStyle","background","pattern","setExpanded","React","errorStyles","FixtureScreenshotModel","version","FixtureScreenshotView","screenshotStyles","SingleComparisonModel","sourceTreeIds","baselineStId","currentStId","SingleComparison","status","statusBadge","compStyles","ScreenshotComparisonRow","ScreenshotImage","src","alt","ReportFixtureView","reportModel","hasScreenshots","ReportComparisonRow","ESTIMATED_ROW_HEIGHT","ROW_GAP","CONTENT_PADDING","OVERSCAN_PX","SCROLL_ANCHOR_KEY","MAX_ANCHOR_ENTRIES","loadScrollAnchors","saveScrollAnchor","anchor","all","pruned","getScrollAnchor","getRowId","row","computeLayout","rows","heightCache","top","layoutTotalHeight","layout","last","findFirstVisibleRow","y","lo","hi","mid","computeVisibleRange","scrollTop","viewportHeight","start","end","bottom","computeAnchor","idx","rowIndex","scrollTopForAnchor","getRowPath","getPathSegments","computeNewHeadings","previous","rowId","idSegments","offset","j","headingTags","headingTagForDepth","headingFontSizes","headingStyleForDepth","PreviewAreaModel","heights","h","prevObsScrollTop","newScrollTop","delta","newMap","changedRows","rid","oldLayout","scrollTopBefore","newLayout","PreviewArea","selectedNodeId","total","currentSegments","prevSegments","newHeadings","Tag","VariantsRowView","ConsolePanelModel","ConsolePanel","events","errorCount","panelStyles","ConsoleEventRow","showStack","setShowStack","isError","isWarn","timeStr","rowStyles","consoleEventsStore","loadingStyle","spinnerStyle","Explorer","loading","themeClass","AsyncStream","_AsyncStream","iterator","ApiError","statusCode","method","ProxyApiClient","_request","_target","_self","createFetchClient","baseUrl","arg","data2","msg","contentType","buffer","decoder","done","eolIndex","finalLine","DaemonModel","config","sourceTreeId","cacheKey","baselineSessionName","currentSessionName","baselineSourceTreeId","currentSourceTreeId","session","map","sessionList","signal","stream","expectedDaemonApiVersion","SemanticVersion","actualDaemonApiVersion","neededByPlugin","runtimeVersion","ReportModel","reportUrl","lastSlash","relativePath","buildTreeFromFixtureIds","response","isLeaf","labels","ExplorerUIMode","element","loadFixtures","daemonConfig","modules","shadow","explorerCss","darkThemeCss","lightThemeCss","uiContainer","createRoot","createElement","fixtureModules","module","globalSetTimeout","HeadlessMode","_containerElement","setError","originalError","originalWarn","originalLog","errorHandler","rejectionHandler","resultData","startTime","syncTimeMs","TIMEOUT_MS","renderTimeout","resolve","totalTimeMs","hasError","renderTimeMs","groupPath","inheritedLabels","effectiveLabels","results","nextPath","api","EmbeddedMode","_container","_fixtureId","loadSourceModule","postSize","rect","parseExplorerQueryParams","params","ExplorerApp","buildInfo","file","fixturesPromise"],"mappings":";;;;;;;;;;AAgCO,SAASA,GAAgBC,GAA8C;AAC5E,SACE,OAAOA,KAAU,YACjBA,MAAU,QACVC,MAAsBD,KACrBA,EAAkCC,EAAkB,MAAM,MAC3D,cAAcD,KACd,OAAQA,EAAgC,YAAa;AAEzD;AAMO,SAASE,GAAeF,GAA6C;AAC1E,SACE,OAAOA,KAAU,YACjBA,MAAU,QAC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AAAA,IACH,MAAMzV,MAAS,cAAcA,MAAS,aAAaA,IAAO;AAAA,IAC1D,SAASyV,EAAO,IAAI,SAAS,KAAK;AAAA,IAClC,MAAMA,EAAO,IAAI,MAAM,KAAK;AAAA,IAC5B,QAAQA,EAAO,IAAI,QAAQ,KAAK;AAAA,EAAA;AAExC;;ACgDO,MAAMC,GAAuC;AAAA,EAGlD,YAAY7C,GAAsB9oB,GAA6B;AAF9C,IAAAK,EAAA;AAGf,UAAMurB,IAAY,WAAW;AAC7B,IAAIA,KACF,QAAQ,IAAI,yBAAyBA,EAAU,OAAO,WAAWA,EAAU,IAAI,GAAG;AAGpF,UAAMF,IAAS,IAAI,gBAAgB,SAAS,MAAM,GAC5C9W,IAA6B6W,GAAyBC,CAAM,GAC5DzQ,IAAYrG,EAAM;AAExB,QAAIA,EAAM,SAAS,YAAY;AAC7B,UAAI,CAACqG;AACH,cAAM,IAAI,MAAM,kDAAkD;AAEpE,YAAM4Q,IAAOjX,EAAM,MACb1T,IAAWlB,EAAQ,aAAa6rB,IAAO,EAAE,MAAAA,EAAA,IAAS,MAAS;AACjE,WAAK,WAAW,IAAIV,GAAarC,GAAS7N,GAAW/Z,CAAQ;AAAA,IAC/D,OAAO;AACL,YAAM4qB,IAAkB9rB,EAAQ,aAAA;AAChC,WAAK,WAAW4U,EAAM,SAAS,aAC3B,IAAIgV,GAAad,GAASgD,CAAe,IACzC,IAAIjD,GAAeC,GAASgD,GAAiB9rB,EAAQ,YAAY;AAAA,IACvE;AAAA,EACF;AAAA,EAEA,eAAeypB,GAAsC;AACnD,SAAK,SAAS,eAAeA,CAAc;AAAA,EAC7C;AAAA,EAEA,cAAoB;AAClB,SAAK,SAAS,YAAA;AAAA,EAChB;AACF;"}
1
+ {"version":3,"file":"viewer.js","sources":["../src/core/fixtureApiConsumer.ts","../../../../vscode-observables/observables/dist/observableInternal/logging/logging.js","../../../../vscode-observables/observables/dist/observableInternal/debugLocation.js","../../../../vscode-observables/observables/dist/observableInternal/debugName.js","../../../../vscode-observables/observables/dist/observableInternal/observables/baseObservable.js","../../../../vscode-observables/observables/dist/observableInternal/commonFacade/deps.js","../../../../vscode-observables/observables/dist/disposables.js","../../../../vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js","../../../../vscode-observables/observables/dist/observableInternal/observables/derived.js","../../../../vscode-observables/observables/dist/observableInternal/reactions/createEffectImpl.js","../../../../vscode-observables/observables/dist/observableInternal/reactions/createEffect.js","../../../../vscode-observables/observables/dist/observableInternal/base.js","../../../../vscode-observables/observables/dist/observableInternal/transaction.js","../../../../vscode-observables/observables/dist/observableInternal/observables/observableValue.js","../../../../vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js","../../../../vscode-observables/observables/dist/observableInternal/utils/utils.js","../../../../vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js","../../../../vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js","../../../../vscode-observables/observables/dist/observableInternal/index.js","../src/core/inputAggregation.ts","../src/core/FixtureInputStore.ts","../src/core/FixturePath.ts","../src/core/DisplayMode.ts","../src/core/FixtureNode.ts","../src/core/FixtureRegistry.ts","../../../../vscode-observables/observables-react/dist/ManualChangesHandler.js","../../../../vscode-observables/observables-react/dist/IPropertyTransformer.js","../../../../vscode-observables/observables-react/dist/utils.js","../../../../vscode-observables/observables-react/dist/viewModel.js","../../../../vscode-observables/observables-react/dist/obsView.js","../../../../vscode-observables/observables-react/dist/view.js","../../../../vscode-observables/observables-react/dist/viewWithModel.js","../../../../vscode-observables/observables-react/dist/Value.js","../../../../vscode-observables/observables-react/dist/di.js","../src/components/types.ts","../src/components/treeFilter.ts","../src/lib/localStorageObservable.ts","../src/lib/queryParamObservable.ts","../src/components/PageViewportState.ts","../src/components/FixtureDebugStore.ts","../src/components/DebugWorkbenchLayout.ts","../src/components/DebugWorkbenchState.ts","../src/components/ExplorerModel.ts","../src/components/styles.ts","../src/components/TitleBarButton.tsx","../src/components/icons.tsx","../src/components/TitleBar.tsx","../src/components/TreeView.tsx","../src/components/SearchInput.tsx","../src/components/LeftSidebar.tsx","../src/components/RightSidebar.tsx","../../common/dist/renderManifest.js","../../common/dist/explorerUrl.js","../src/lib/fixtureSizeCache.ts","../src/core/ConsoleEventsStore.ts","../src/core/FixtureInteractionRuntime.ts","../src/core/ComponentRenderer.ts","../src/lib/explorerShadowHost.ts","../src/lib/fixtureFocusTrap.ts","../src/components/ConsolePanel.tsx","../src/components/DebugWorkbench.tsx","../src/components/DebugPanelPlacement.ts","../src/components/FixturePreviewItem.tsx","../src/components/FixtureScreenshotView.tsx","../src/components/ScreenshotComparisonRow.tsx","../src/components/ReportComparisonRow.tsx","../src/components/PreviewArea.tsx","../src/components/BottomDebugPanel.tsx","../src/components/Explorer.tsx","../../simple-api/dist/chunk-TTRCY65Z.mjs","../../simple-api/dist/chunk-WNXMRXWV.mjs","../src/daemon/DaemonModel.ts","../src/report/ReportModel.ts","../src/modes/ExplorerUIMode.ts","../src/modes/HeadlessMode.ts","../src/modes/EmbeddedMode.ts","../src/lib/explorerQueryParams.ts","../src/viewer.ts"],"sourcesContent":["/**\n * Fixture API Consumer\n * \n * This module validates and consumes fixture exports created by fixtureApi.\n * It provides type guards and parsing functions for cross-version compatibility.\n * \n * The viewer imports this module to parse fixtures; projects never need this.\n */\n\nimport {\n singleFixtureBrand,\n fixtureGroupBrand,\n fixtureVariantsBrand,\n type FixtureExport,\n type SingleFixtureExport,\n type FixtureGroupExport,\n type FixtureVariantsExport,\n type DisplayMode,\n type StyleDefinition,\n type RenderReturn,\n type RenderContext,\n type IJsonSchema,\n type DebugPanelDefinition,\n type FixtureInputControlOptions,\n} from './fixtureApi.js';\n\n// ============================================================================\n// Type guards (use these for runtime checks)\n// Cross-version compatible thanks to Symbol.for() in fixtureApi.ts\n// ============================================================================\n\n/**\n * Type guard for SingleFixtureExport.\n * Uses the global symbol brand for cross-version compatibility.\n */\nexport function isSingleFixture(value: unknown): value is SingleFixtureExport {\n return (\n typeof value === 'object' &&\n value !== null &&\n singleFixtureBrand in value &&\n (value as Record<symbol, unknown>)[singleFixtureBrand] === true &&\n '_options' in value &&\n typeof (value as { _options: unknown })._options === 'object'\n );\n}\n\n/**\n * Type guard for FixtureGroupExport.\n * Uses the global symbol brand for cross-version compatibility.\n */\nexport function isFixtureGroup(value: unknown): value is FixtureGroupExport {\n return (\n typeof value === 'object' &&\n value !== null &&\n fixtureGroupBrand in value &&\n (value as Record<symbol, unknown>)[fixtureGroupBrand] === true &&\n '_entries' in value &&\n typeof (value as { _entries: unknown })._entries === 'object'\n );\n}\n\n/**\n * Type guard for FixtureVariantsExport.\n * Uses the global symbol brand for cross-version compatibility.\n */\nexport function isFixtureVariants(value: unknown): value is FixtureVariantsExport {\n return (\n typeof value === 'object' &&\n value !== null &&\n fixtureVariantsBrand in value &&\n (value as Record<symbol, unknown>)[fixtureVariantsBrand] === true &&\n '_variants' in value &&\n typeof (value as { _variants: unknown })._variants === 'object'\n );\n}\n\n/**\n * Type guard for any fixture export type.\n */\nexport function isFixtureExport(value: unknown): value is FixtureExport {\n return isSingleFixture(value) || isFixtureGroup(value) || isFixtureVariants(value);\n}\n\n// ============================================================================\n// Parsing functions (validate and cast)\n// ============================================================================\n\nexport type ParseResult<T> =\n | { success: true; data: T }\n | { success: false; error: string };\n\n/**\n * Parses and validates a potential fixture export.\n * Returns a ParseResult with either the validated data or an error message.\n */\nexport function parseFixtureExport(value: unknown): ParseResult<FixtureExport> {\n if (isSingleFixture(value)) {\n return { success: true, data: value };\n }\n if (isFixtureGroup(value)) {\n return { success: true, data: value };\n }\n if (isFixtureVariants(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a valid fixture export (missing brand symbol or _options/_entries/_variants)' };\n}\n\n/**\n * Parses and validates a single fixture export.\n */\nexport function parseSingleFixture(value: unknown): ParseResult<SingleFixtureExport> {\n if (isSingleFixture(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a SingleFixtureExport' };\n}\n\n/**\n * Parses and validates a fixture group export.\n */\nexport function parseFixtureGroup(value: unknown): ParseResult<FixtureGroupExport> {\n if (isFixtureGroup(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a FixtureGroupExport' };\n}\n\n/**\n * Parses and validates a fixture variants export.\n */\nexport function parseFixtureVariants(value: unknown): ParseResult<FixtureVariantsExport> {\n if (isFixtureVariants(value)) {\n return { success: true, data: value };\n }\n return { success: false, error: 'Value is not a FixtureVariantsExport' };\n}\n\n// ============================================================================\n// ComponentDefinition creation (moved from defineFixture.ts)\n// ============================================================================\n\n/**\n * Definition of a component fixture (internal representation).\n */\nexport interface ComponentDefinition {\n /** Unique identifier within the fixture file */\n readonly id: string;\n\n /** Display name shown in the tree */\n readonly name: string;\n\n /** Optional description for documentation */\n readonly description?: string;\n\n /** How to isolate this component from other components */\n readonly isolation: 'none' | 'shadow-dom' | 'iframe';\n\n /** How to display: page (device viewport) or component (natural size) */\n readonly displayMode: DisplayMode;\n\n /** Stylesheets to inject (into document head, shadow root, or iframe head depending on isolation mode) */\n readonly styles?: readonly StyleDefinition[];\n\n /** Background pattern for the preview canvas: 'light' (default) or 'dark' for dark transparent pattern */\n readonly background: 'light' | 'dark';\n\n /** Labels for categorization and filtering */\n readonly labels: readonly string[];\n\n /** Accumulated expected visual descriptions (from self + parent groups/variants) */\n readonly expectedVisualDescriptions: readonly string[];\n\n /** JSON Schema describing the expected shape of `RenderContext.input` (always an object). */\n readonly inputSchema?: IJsonSchema;\n\n /** Explorer presentation metadata for input properties. */\n readonly inputControls?: Readonly<Record<string, FixtureInputControlOptions>>;\n\n /** Statically declared custom debug panels. */\n readonly debugPanels: readonly DebugPanelDefinition<unknown, unknown>[];\n\n /** Source file path this fixture was defined in */\n readonly sourceFile: string;\n\n /**\n * Render the component into the container.\n * Returns an optional RenderResult or Promise for cleanup and async readiness.\n */\n render(container: HTMLElement, context: RenderContext): RenderReturn;\n}\n\n/**\n * Creates the component definition from a validated SingleFixtureExport.\n *\n * @param inheritedInputSchema - JSON Schema accumulated from enclosing groups/variants; merged\n * with the fixture's own schema (the fixture's properties win on conflict).\n */\nexport function createComponentDefinition(\n fixture: SingleFixtureExport,\n id: string,\n name: string,\n sourceFile: string,\n inheritedVisualDescriptions: readonly string[] = [],\n inheritedInputSchema: IJsonSchema | undefined = undefined,\n): ComponentDefinition {\n const options = fixture._options;\n const ownDescriptions = options.expectedVisualDescriptions\n ? (typeof options.expectedVisualDescriptions === 'string' ? [options.expectedVisualDescriptions] : [...options.expectedVisualDescriptions])\n : [];\n const expectedVisualDescriptions = [...inheritedVisualDescriptions, ...ownDescriptions];\n return {\n id,\n name,\n description: options.description,\n isolation: options.isolation ?? 'none',\n displayMode: options.displayMode ?? { type: 'component' },\n styles: options.styles,\n background: options.background ?? 'light',\n labels: options.labels ?? [],\n expectedVisualDescriptions,\n inputSchema: mergeInputSchemas(inheritedInputSchema, fixture._inputSchemaJson),\n inputControls: options.inputControls as Readonly<Record<string, FixtureInputControlOptions>> | undefined,\n debugPanels: options.debugPanels ?? [],\n sourceFile,\n render: options.render,\n };\n}\n\n/**\n * Merges two object JSON Schemas. `child` properties win over `parent` on key conflicts;\n * `required` is the de-duplicated union. Returns whichever side is defined when only one is.\n */\nexport function mergeInputSchemas(\n parent: IJsonSchema | undefined,\n child: IJsonSchema | undefined,\n): IJsonSchema | undefined {\n if (!parent) { return child; }\n if (!child) { return parent; }\n const properties = { ...(parent.properties ?? {}), ...(child.properties ?? {}) };\n const required = [...new Set<string>([...(parent.required ?? []), ...(child.required ?? [])])];\n return {\n ...parent,\n ...child,\n type: 'object',\n properties,\n ...(required.length ? { required } : {}),\n };\n}\n\n/**\n * Builds the effective `input` object passed to a fixture: the schema's top-level property\n * defaults, overlaid with any caller-provided overrides. Returns the override unchanged when\n * there is no schema (so schemaless fixtures keep their original `undefined`/passthrough input).\n */\nexport function applyInputDefaults(schema: IJsonSchema | undefined, input: unknown): unknown {\n const overrides = (input && typeof input === 'object' && !Array.isArray(input))\n ? (input as Record<string, unknown>)\n : undefined;\n if (!schema?.properties) {\n return input;\n }\n const result: Record<string, unknown> = {};\n for (const [key, prop] of Object.entries(schema.properties)) {\n if (prop && typeof prop === 'object' && prop.default !== undefined) {\n result[key] = prop.default;\n }\n }\n if (overrides) {\n Object.assign(result, overrides);\n }\n return result;\n}\n\n/**\n * Type guard for checking if a value is a ComponentDefinition.\n * @deprecated Use isSingleFixture or isFixtureGroup instead\n */\nexport function isComponentDefinition(value: unknown): value is ComponentDefinition {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'render' in value &&\n typeof (value as ComponentDefinition).render === 'function' &&\n 'id' in value &&\n 'name' in value\n );\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nlet globalObservableLogger;\nfunction addLogger(logger) {\n if (!globalObservableLogger) {\n globalObservableLogger = logger;\n }\n else if (globalObservableLogger instanceof ComposedLogger) {\n globalObservableLogger.loggers.push(logger);\n }\n else {\n globalObservableLogger = new ComposedLogger([globalObservableLogger, logger]);\n }\n}\nfunction getLogger() {\n return globalObservableLogger;\n}\nlet globalObservableLoggerFn = undefined;\nfunction setLogObservableFn(fn) {\n globalObservableLoggerFn = fn;\n}\nfunction logObservable(obs) {\n if (globalObservableLoggerFn) {\n globalObservableLoggerFn(obs);\n }\n}\nclass ComposedLogger {\n constructor(loggers) {\n this.loggers = loggers;\n }\n handleObservableCreated(observable, location) {\n for (const logger of this.loggers) {\n logger.handleObservableCreated(observable, location);\n }\n }\n handleOnListenerCountChanged(observable, newCount) {\n for (const logger of this.loggers) {\n logger.handleOnListenerCountChanged(observable, newCount);\n }\n }\n handleObservableUpdated(observable, info) {\n for (const logger of this.loggers) {\n logger.handleObservableUpdated(observable, info);\n }\n }\n handleAutorunCreated(autorun, location) {\n for (const logger of this.loggers) {\n logger.handleAutorunCreated(autorun, location);\n }\n }\n handleAutorunDisposed(autorun) {\n for (const logger of this.loggers) {\n logger.handleAutorunDisposed(autorun);\n }\n }\n handleAutorunDependencyChanged(autorun, observable, change) {\n for (const logger of this.loggers) {\n logger.handleAutorunDependencyChanged(autorun, observable, change);\n }\n }\n handleAutorunStarted(autorun) {\n for (const logger of this.loggers) {\n logger.handleAutorunStarted(autorun);\n }\n }\n handleAutorunFinished(autorun) {\n for (const logger of this.loggers) {\n logger.handleAutorunFinished(autorun);\n }\n }\n handleDerivedDependencyChanged(derived, observable, change) {\n for (const logger of this.loggers) {\n logger.handleDerivedDependencyChanged(derived, observable, change);\n }\n }\n handleDerivedCleared(observable) {\n for (const logger of this.loggers) {\n logger.handleDerivedCleared(observable);\n }\n }\n handleBeginTransaction(transaction) {\n for (const logger of this.loggers) {\n logger.handleBeginTransaction(transaction);\n }\n }\n handleEndTransaction(transaction) {\n for (const logger of this.loggers) {\n logger.handleEndTransaction(transaction);\n }\n }\n}\n\nexport { addLogger, getLogger, logObservable, setLogObservableFn };\n//# sourceMappingURL=logging.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nvar DebugLocation;\n(function (DebugLocation) {\n let enabled = false;\n function enable() {\n enabled = true;\n }\n DebugLocation.enable = enable;\n function ofCaller() {\n return ofNthCaller(1);\n }\n DebugLocation.ofCaller = ofCaller;\n function ofNthCaller(n) {\n if (!enabled) {\n return undefined;\n }\n const Err = Error; // For the monaco editor checks, which don't have the nodejs types.\n const l = Err.stackTraceLimit;\n Err.stackTraceLimit = 3;\n const stack = new Error().stack;\n Err.stackTraceLimit = l;\n return DebugLocationImpl.fromStack(stack, n + 1);\n }\n DebugLocation.ofNthCaller = ofNthCaller;\n})(DebugLocation || (DebugLocation = {}));\nclass DebugLocationImpl {\n static fromStack(stack, parentIdx) {\n const lines = stack.split('\\n');\n const location = parseLine(lines[parentIdx + 1]);\n if (location) {\n return new DebugLocationImpl(location.fileName, location.line, location.column, location.id);\n }\n else {\n return undefined;\n }\n }\n constructor(fileName, line, column, id) {\n this.fileName = fileName;\n this.line = line;\n this.column = column;\n this.id = id;\n }\n}\nfunction parseLine(stackLine) {\n if (!stackLine) {\n return undefined;\n }\n const match = stackLine.match(/\\((.*):(\\d+):(\\d+)\\)/);\n if (match) {\n return {\n fileName: match[1],\n line: parseInt(match[2]),\n column: parseInt(match[3]),\n id: stackLine,\n };\n }\n const match2 = stackLine.match(/at ([^\\(\\)]*):(\\d+):(\\d+)/);\n if (match2) {\n return {\n fileName: match2[1],\n line: parseInt(match2[2]),\n column: parseInt(match2[3]),\n id: stackLine,\n };\n }\n return undefined;\n}\n\nexport { DebugLocation };\n//# sourceMappingURL=debugLocation.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass DebugNameData {\n constructor(owner, debugNameSource, referenceFn) {\n this.owner = owner;\n this.debugNameSource = debugNameSource;\n this.referenceFn = referenceFn;\n }\n getDebugName(target) {\n return getDebugName(target, this);\n }\n}\nconst countPerName = new Map();\nconst cachedDebugName = new WeakMap();\nfunction getDebugName(target, data) {\n const cached = cachedDebugName.get(target);\n if (cached) {\n return cached;\n }\n const dbgName = computeDebugName(target, data);\n if (dbgName) {\n let count = countPerName.get(dbgName) ?? 0;\n count++;\n countPerName.set(dbgName, count);\n const result = count === 1 ? dbgName : `${dbgName}#${count}`;\n cachedDebugName.set(target, result);\n return result;\n }\n return undefined;\n}\nfunction computeDebugName(self, data) {\n const cached = cachedDebugName.get(self);\n if (cached) {\n return cached;\n }\n const ownerStr = data.owner ? formatOwner(data.owner) + `.` : '';\n let result;\n const debugNameSource = data.debugNameSource;\n if (debugNameSource !== undefined) {\n if (typeof debugNameSource === 'function') {\n result = debugNameSource();\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n else {\n return ownerStr + debugNameSource;\n }\n }\n const referenceFn = data.referenceFn;\n if (referenceFn !== undefined) {\n result = getFunctionName(referenceFn);\n if (result !== undefined) {\n return ownerStr + result;\n }\n }\n if (data.owner !== undefined) {\n const key = findKey(data.owner, self);\n if (key !== undefined) {\n return ownerStr + key;\n }\n }\n return undefined;\n}\nfunction findKey(obj, value) {\n for (const key in obj) {\n if (obj[key] === value) {\n return key;\n }\n }\n return undefined;\n}\nconst countPerClassName = new Map();\nconst ownerId = new WeakMap();\nfunction formatOwner(owner) {\n const id = ownerId.get(owner);\n if (id) {\n return id;\n }\n const className = getClassName(owner) ?? 'Object';\n let count = countPerClassName.get(className) ?? 0;\n count++;\n countPerClassName.set(className, count);\n const result = count === 1 ? className : `${className}#${count}`;\n ownerId.set(owner, result);\n return result;\n}\nfunction getClassName(obj) {\n const ctor = obj.constructor;\n if (ctor) {\n if (ctor.name === 'Object') {\n return undefined;\n }\n return ctor.name;\n }\n return undefined;\n}\nfunction getFunctionName(fn) {\n const fnSrc = fn.toString();\n // Pattern: /** @description ... */\n const regexp = /\\/\\*\\*\\s*@description\\s*([^*]*)\\*\\//;\n const match = regexp.exec(fnSrc);\n const result = match ? match[1] : undefined;\n return result?.trim();\n}\n\nexport { DebugNameData, getClassName, getDebugName, getFunctionName };\n//# sourceMappingURL=debugName.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DebugLocation } from '../debugLocation.js';\nimport { getFunctionName } from '../debugName.js';\nimport { logObservable, getLogger } from '../logging/logging.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nlet _derived;\n/**\n * @internal\n * This is to allow splitting files.\n*/\nfunction _setDerivedOpts(derived) {\n _derived = derived;\n}\nlet _recomputeInitiallyAndOnChange;\nfunction _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange) {\n _recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange;\n}\nlet _keepObserved;\nfunction _setKeepObserved(keepObserved) {\n _keepObserved = keepObserved;\n}\nlet _debugGetDependencyGraph;\nfunction _setDebugGetDependencyGraph(debugGetDependencyGraph) {\n _debugGetDependencyGraph = debugGetDependencyGraph;\n}\nclass ConvenientObservable {\n get TChange() { return null; }\n reportChanges() {\n this.get();\n }\n /** @sealed */\n read(reader) {\n if (reader) {\n return reader.readObservable(this);\n }\n else {\n return this.get();\n }\n }\n map(fnOrOwner, fnOrUndefined, debugLocation = DebugLocation.ofCaller()) {\n const owner = fnOrUndefined === undefined ? undefined : fnOrOwner;\n const fn = fnOrUndefined === undefined ? fnOrOwner : fnOrUndefined;\n return _derived({\n owner,\n debugName: () => {\n const name = getFunctionName(fn);\n if (name !== undefined) {\n return name;\n }\n // regexp to match `x => x.y` or `x => x?.y` where x and y can be arbitrary identifiers (uses backref):\n const regexp = /^\\s*\\(?\\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*\\)?\\s*=>\\s*\\1(?:\\??)\\.([a-zA-Z_$][a-zA-Z_$0-9]*)\\s*$/;\n const match = regexp.exec(fn.toString());\n if (match) {\n return `${this.debugName}.${match[2]}`;\n }\n if (!owner) {\n return `${this.debugName} (mapped)`;\n }\n return undefined;\n },\n debugReferenceFn: fn,\n }, (reader) => fn(this.read(reader), reader), debugLocation);\n }\n /**\n * @sealed\n * Converts an observable of an observable value into a direct observable of the value.\n */\n flatten() {\n return _derived({\n owner: undefined,\n debugName: () => `${this.debugName} (flattened)`,\n }, (reader) => this.read(reader).read(reader));\n }\n recomputeInitiallyAndOnChange(store, handleValue) {\n store.add(_recomputeInitiallyAndOnChange(this, handleValue));\n return this;\n }\n /**\n * Ensures that this observable is observed. This keeps the cache alive.\n * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).\n * Use `recomputeInitiallyAndOnChange` for eager evaluation.\n */\n keepObserved(store) {\n store.add(_keepObserved(this));\n return this;\n }\n get debugValue() {\n return this.get();\n }\n debugGetDependencyGraph() {\n return _debugGetDependencyGraph(this);\n }\n}\nclass BaseObservable extends ConvenientObservable {\n constructor(debugLocation) {\n super();\n this._observers = new Set();\n getLogger()?.handleObservableCreated(this, debugLocation);\n }\n addObserver(observer) {\n const len = this._observers.size;\n this._observers.add(observer);\n if (len === 0) {\n this.onFirstObserverAdded();\n }\n if (len !== this._observers.size) {\n getLogger()?.handleOnListenerCountChanged(this, this._observers.size);\n }\n }\n removeObserver(observer) {\n const deleted = this._observers.delete(observer);\n if (deleted && this._observers.size === 0) {\n this.onLastObserverRemoved();\n }\n if (deleted) {\n getLogger()?.handleOnListenerCountChanged(this, this._observers.size);\n }\n }\n onFirstObserverAdded() { }\n onLastObserverRemoved() { }\n log() {\n const hadLogger = !!getLogger();\n logObservable(this);\n if (!hadLogger) {\n getLogger()?.handleObservableCreated(this, DebugLocation.ofCaller());\n }\n return this;\n }\n debugGetObservers() {\n return this._observers;\n }\n}\n\nexport { BaseObservable, ConvenientObservable, _setDebugGetDependencyGraph, _setDerivedOpts, _setKeepObserved, _setRecomputeInitiallyAndOnChange };\n//# sourceMappingURL=baseObservable.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction toDisposable(fn) {\n return {\n dispose: fn\n };\n}\nclass BugIndicatingError extends Error {\n constructor(message) {\n super(message || 'An unexpected bug occurred.');\n Object.setPrototypeOf(this, BugIndicatingError.prototype);\n // Because we know for sure only buggy code throws this,\n // we definitely want to break here and fix the bug.\n // eslint-disable-next-line no-debugger\n // debugger;\n }\n}\nfunction onBugIndicatingError(error) {\n // debugger;\n throw error;\n}\nfunction onUnexpectedError(error) {\n console.error('Unexpected error:', error);\n}\n/**\n * Compares two items for equality using strict equality.\n*/\nconst strictEquals = (a, b) => a === b;\n\nexport { BugIndicatingError, onBugIndicatingError, onUnexpectedError, strictEquals, toDisposable };\n//# sourceMappingURL=deps.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass DisposableStore {\n constructor() {\n this.disposables = [];\n this._isDisposed = false;\n }\n get isDisposed() { return this._isDisposed; }\n dispose() {\n this.clear();\n this._isDisposed = true;\n }\n add(disposable) {\n if (disposable) {\n this.disposables.push(disposable);\n }\n return disposable;\n }\n remove(disposable) {\n if (!disposable) {\n return disposable;\n }\n const index = this.disposables.indexOf(disposable);\n if (index !== -1) {\n this.disposables.splice(index, 1);\n }\n return disposable;\n }\n clear() {\n for (const disposable of this.disposables) {\n disposable.dispose();\n }\n this.disposables = [];\n }\n leakItems() {\n this.disposables = [];\n }\n}\nclass Disposable {\n constructor() {\n this._store = new DisposableStore();\n }\n dispose() {\n this._store.dispose();\n }\n _register(t) {\n this._store.add(t);\n return t;\n }\n _registerOrDispose(t) {\n if (t) {\n if (this._store.isDisposed) {\n t.dispose();\n }\n else {\n this._store.add(t);\n }\n }\n return t;\n }\n}\n\nexport { Disposable, DisposableStore };\n//# sourceMappingURL=disposables.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { BaseObservable } from './baseObservable.js';\nimport { BugIndicatingError, onBugIndicatingError } from '../commonFacade/deps.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction derivedStateToString(state) {\n switch (state) {\n case 0 /* DerivedState.initial */: return 'initial';\n case 1 /* DerivedState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';\n case 2 /* DerivedState.stale */: return 'stale';\n case 3 /* DerivedState.upToDate */: return 'upToDate';\n default: return '<unknown>';\n }\n}\nclass Derived extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? '(anonymous)';\n }\n constructor(_debugNameData, _computeFn, _changeTracker, _handleLastObserverRemoved = undefined, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._computeFn = _computeFn;\n this._changeTracker = _changeTracker;\n this._handleLastObserverRemoved = _handleLastObserverRemoved;\n this._equalityComparator = _equalityComparator;\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n this._updateCount = 0;\n this._dependencies = new Set();\n this._dependenciesToBeRemoved = new Set();\n this._changeSummary = undefined;\n this._isUpdating = false;\n this._isComputing = false;\n this._didReportChange = false;\n this._isInBeforeUpdate = false;\n this._isReaderValid = false;\n this._store = undefined;\n this._delayedStore = undefined;\n this._removedObserverToCallEndUpdateOn = null;\n this._changeSummary = this._changeTracker?.createChangeSummary(undefined);\n }\n onLastObserverRemoved() {\n /**\n * We are not tracking changes anymore, thus we have to assume\n * that our cache is invalid.\n */\n this._state = 0 /* DerivedState.initial */;\n this._value = undefined;\n getLogger()?.handleDerivedCleared(this);\n for (const d of this._dependencies) {\n d.removeObserver(this);\n }\n this._dependencies.clear();\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n if (this._delayedStore !== undefined) {\n this._delayedStore.dispose();\n this._delayedStore = undefined;\n }\n this._handleLastObserverRemoved?.();\n }\n get() {\n const checkEnabled = false; // TODO set to true\n if (this._isComputing && checkEnabled) {\n // investigate why this fails in the diff editor!\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n if (this._observers.size === 0) {\n let result;\n // Without observers, we don't know when to clean up stuff.\n // Thus, we don't cache anything to prevent memory leaks.\n try {\n this._isReaderValid = true;\n let changeSummary = undefined;\n if (this._changeTracker) {\n changeSummary = this._changeTracker.createChangeSummary(undefined);\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n }\n result = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\n }\n // Clear new dependencies\n this.onLastObserverRemoved();\n return result;\n }\n else {\n do {\n // We might not get a notification for a dependency that changed while it is updating,\n // thus we also have to ask all our depedencies if they changed in this case.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n for (const d of this._dependencies) {\n /** might call {@link handleChange} indirectly, which could make us stale */\n d.reportChanges();\n if (this._state === 2 /* DerivedState.stale */) {\n // The other dependencies will refresh on demand, so early break\n break;\n }\n }\n }\n // We called report changes of all dependencies.\n // If we are still not stale, we can assume to be up to date again.\n if (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */) {\n this._state = 3 /* DerivedState.upToDate */;\n }\n if (this._state !== 3 /* DerivedState.upToDate */) {\n this._recompute();\n }\n // In case recomputation changed one of our dependencies, we need to recompute again.\n } while (this._state !== 3 /* DerivedState.upToDate */);\n return this._value;\n }\n }\n _recompute() {\n let didChange = false;\n this._isComputing = true;\n this._didReportChange = false;\n const emptySet = this._dependenciesToBeRemoved;\n this._dependenciesToBeRemoved = this._dependencies;\n this._dependencies = emptySet;\n try {\n const changeSummary = this._changeSummary;\n this._isReaderValid = true;\n if (this._changeTracker) {\n this._isInBeforeUpdate = true;\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n this._isInBeforeUpdate = false;\n this._changeSummary = this._changeTracker?.createChangeSummary(changeSummary);\n }\n const hadValue = this._state !== 0 /* DerivedState.initial */;\n const oldValue = this._value;\n this._state = 3 /* DerivedState.upToDate */;\n const delayedStore = this._delayedStore;\n if (delayedStore !== undefined) {\n this._delayedStore = undefined;\n }\n try {\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n /** might call {@link handleChange} indirectly, which could invalidate us */\n this._value = this._computeFn(this, changeSummary);\n }\n finally {\n this._isReaderValid = false;\n // We don't want our observed observables to think that they are (not even temporarily) not being observed.\n // Thus, we only unsubscribe from observables that are definitely not read anymore.\n for (const o of this._dependenciesToBeRemoved) {\n o.removeObserver(this);\n }\n this._dependenciesToBeRemoved.clear();\n if (delayedStore !== undefined) {\n delayedStore.dispose();\n }\n }\n didChange = this._didReportChange || (hadValue && !(this._equalityComparator(oldValue, this._value)));\n getLogger()?.handleObservableUpdated(this, {\n oldValue,\n newValue: this._value,\n change: undefined,\n didChange,\n hadValue,\n });\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n this._isComputing = false;\n if (!this._didReportChange && didChange) {\n for (const r of this._observers) {\n r.handleChange(this, undefined);\n }\n }\n else {\n this._didReportChange = false;\n }\n }\n toString() {\n return `LazyDerived<${this.debugName}>`;\n }\n // IObserver Implementation\n beginUpdate(_observable) {\n if (this._isUpdating) {\n throw new BugIndicatingError('Cyclic deriveds are not supported yet!');\n }\n this._updateCount++;\n this._isUpdating = true;\n try {\n const propagateBeginUpdate = this._updateCount === 1;\n if (this._state === 3 /* DerivedState.upToDate */) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n // If we propagate begin update, that will already signal a possible change.\n if (!propagateBeginUpdate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n if (propagateBeginUpdate) {\n for (const r of this._observers) {\n r.beginUpdate(this); // This signals a possible change\n }\n }\n }\n finally {\n this._isUpdating = false;\n }\n }\n endUpdate(_observable) {\n this._updateCount--;\n if (this._updateCount === 0) {\n // End update could change the observer list.\n const observers = [...this._observers];\n for (const r of observers) {\n r.endUpdate(this);\n }\n if (this._removedObserverToCallEndUpdateOn) {\n const observers = [...this._removedObserverToCallEndUpdateOn];\n this._removedObserverToCallEndUpdateOn = null;\n for (const r of observers) {\n r.endUpdate(this);\n }\n }\n }\n }\n handlePossibleChange(observable) {\n // In all other states, observers already know that we might have changed.\n if (this._state === 3 /* DerivedState.upToDate */ && this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable)) {\n this._state = 1 /* DerivedState.dependenciesMightHaveChanged */;\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n handleChange(observable, change) {\n if (this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable) || this._isInBeforeUpdate) {\n getLogger()?.handleDerivedDependencyChanged(this, observable, change);\n let shouldReact = false;\n try {\n shouldReact = this._changeTracker ? this._changeTracker.handleChange({\n changedObservable: observable,\n change,\n didChange: (o) => o === observable,\n }, this._changeSummary) : true;\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n const wasUpToDate = this._state === 3 /* DerivedState.upToDate */;\n if (shouldReact && (this._state === 1 /* DerivedState.dependenciesMightHaveChanged */ || wasUpToDate)) {\n this._state = 2 /* DerivedState.stale */;\n if (wasUpToDate) {\n for (const r of this._observers) {\n r.handlePossibleChange(this);\n }\n }\n }\n }\n }\n // IReader Implementation\n _ensureReaderValid() {\n if (!this._isReaderValid) {\n throw new BugIndicatingError('The reader object cannot be used outside its compute function!');\n }\n }\n readObservable(observable) {\n this._ensureReaderValid();\n // Subscribe before getting the value to enable caching\n observable.addObserver(this);\n /** This might call {@link handleChange} indirectly, which could invalidate us */\n const value = observable.get();\n // Which is why we only add the observable to the dependencies now.\n this._dependencies.add(observable);\n this._dependenciesToBeRemoved.delete(observable);\n return value;\n }\n reportChange(change) {\n this._ensureReaderValid();\n this._didReportChange = true;\n // TODO add logging\n for (const r of this._observers) {\n r.handleChange(this, change);\n }\n }\n get store() {\n this._ensureReaderValid();\n if (this._store === undefined) {\n this._store = new DisposableStore();\n }\n return this._store;\n }\n get delayedStore() {\n this._ensureReaderValid();\n if (this._delayedStore === undefined) {\n this._delayedStore = new DisposableStore();\n }\n return this._delayedStore;\n }\n addObserver(observer) {\n const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCount > 0;\n super.addObserver(observer);\n if (shouldCallBeginUpdate) {\n if (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(observer)) {\n this._removedObserverToCallEndUpdateOn.delete(observer);\n }\n else {\n observer.beginUpdate(this);\n }\n }\n }\n removeObserver(observer) {\n if (this._observers.has(observer) && this._updateCount > 0) {\n if (!this._removedObserverToCallEndUpdateOn) {\n this._removedObserverToCallEndUpdateOn = new Set();\n }\n this._removedObserverToCallEndUpdateOn.add(observer);\n }\n super.removeObserver(observer);\n }\n debugGetState() {\n return {\n state: this._state,\n stateStr: derivedStateToString(this._state),\n updateCount: this._updateCount,\n isComputing: this._isComputing,\n dependencies: this._dependencies,\n value: this._value,\n };\n }\n debugSetValue(newValue) {\n this._value = newValue;\n }\n debugRecompute() {\n if (!this._isComputing) {\n this._recompute();\n }\n else {\n this._state = 2 /* DerivedState.stale */;\n }\n }\n setValue(newValue, tx, change) {\n this._value = newValue;\n const observers = this._observers;\n tx.updateObserver(this, this);\n for (const d of observers) {\n d.handleChange(this, change);\n }\n }\n}\nclass DerivedWithSetter extends Derived {\n constructor(debugNameData, computeFn, changeTracker, handleLastObserverRemoved = undefined, equalityComparator, set, debugLocation) {\n super(debugNameData, computeFn, changeTracker, handleLastObserverRemoved, equalityComparator, debugLocation);\n this.set = set;\n }\n}\n\nexport { Derived, DerivedWithSetter };\n//# sourceMappingURL=derivedImpl.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugLocation } from '../debugLocation.js';\nimport { DebugNameData } from '../debugName.js';\nimport { _setDerivedOpts } from './baseObservable.js';\nimport { Derived, DerivedWithSetter } from './derivedImpl.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction derived(computeFnOrOwner, computeFn, debugLocation = DebugLocation.ofCaller()) {\n if (computeFn !== undefined) {\n return new Derived(new DebugNameData(computeFnOrOwner, undefined, computeFn), computeFn, undefined, undefined, strictEquals, debugLocation);\n }\n return new Derived(new DebugNameData(undefined, undefined, computeFnOrOwner), computeFnOrOwner, undefined, undefined, strictEquals, debugLocation);\n}\nfunction derivedWithSetter(owner, computeFn, setter, debugLocation = DebugLocation.ofCaller()) {\n return new DerivedWithSetter(new DebugNameData(owner, undefined, computeFn), computeFn, undefined, undefined, strictEquals, setter, debugLocation);\n}\nfunction derivedOpts(options, computeFn, debugLocation = DebugLocation.ofCaller()) {\n return new Derived(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn), computeFn, undefined, options.onLastObserverRemoved, options.equalsFn ?? strictEquals, debugLocation);\n}\n_setDerivedOpts(derivedOpts);\n/**\n * Represents an observable that is derived from other observables.\n * The value is only recomputed when absolutely needed.\n *\n * {@link computeFn} should start with a JS Doc using `@description` to name the derived.\n *\n * Use `createEmptyChangeSummary` to create a \"change summary\" that can collect the changes.\n * Use `handleChange` to add a reported change to the change summary.\n * The compute function is given the last change summary.\n * The change summary is discarded after the compute function was called.\n *\n * @see derived\n */\nfunction derivedHandleChanges(options, computeFn, debugLocation = DebugLocation.ofCaller()) {\n return new Derived(new DebugNameData(options.owner, options.debugName, undefined), computeFn, options.changeTracker, undefined, options.equalityComparer ?? strictEquals, debugLocation);\n}\nfunction derivedWithStore(computeFnOrOwner, computeFnOrUndefined, debugLocation = DebugLocation.ofCaller()) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n // Intentionally re-assigned in case an inactive observable is re-used later\n // eslint-disable-next-line local/code-no-potentially-unsafe-disposables\n let store = new DisposableStore();\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n if (store.isDisposed) {\n store = new DisposableStore();\n }\n else {\n store.clear();\n }\n return computeFn(r, store);\n }, undefined, () => store.dispose(), strictEquals, debugLocation);\n}\nfunction derivedDisposable(computeFnOrOwner, computeFnOrUndefined, debugLocation = DebugLocation.ofCaller()) {\n let computeFn;\n let owner;\n if (computeFnOrUndefined === undefined) {\n computeFn = computeFnOrOwner;\n owner = undefined;\n }\n else {\n owner = computeFnOrOwner;\n computeFn = computeFnOrUndefined;\n }\n let store = undefined;\n return new Derived(new DebugNameData(owner, undefined, computeFn), r => {\n if (!store) {\n store = new DisposableStore();\n }\n else {\n store.clear();\n }\n const result = computeFn(r);\n if (result) {\n store.add(result);\n }\n return result;\n }, undefined, () => {\n if (store) {\n store.dispose();\n store = undefined;\n }\n }, strictEquals, debugLocation);\n}\n\nexport { derived, derivedDisposable, derivedHandleChanges, derivedOpts, derivedWithSetter, derivedWithStore };\n//# sourceMappingURL=derived.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { onBugIndicatingError, BugIndicatingError } from '../commonFacade/deps.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction autorunStateToString(state) {\n switch (state) {\n case 1 /* AutorunState.dependenciesMightHaveChanged */: return 'dependenciesMightHaveChanged';\n case 2 /* AutorunState.stale */: return 'stale';\n case 3 /* AutorunState.upToDate */: return 'upToDate';\n default: return '<unknown>';\n }\n}\nclass AutorunObserver {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? '(anonymous)';\n }\n constructor(_debugNameData, _runFn, _changeTracker, debugLocation) {\n this._debugNameData = _debugNameData;\n this._runFn = _runFn;\n this._changeTracker = _changeTracker;\n this._state = 2 /* AutorunState.stale */;\n this._updateCount = 0;\n this._disposed = false;\n this._dependencies = new Set();\n this._dependenciesToBeRemoved = new Set();\n this._isRunning = false;\n this._store = undefined;\n this._delayedStore = undefined;\n this._changeSummary = this._changeTracker?.createChangeSummary(undefined);\n getLogger()?.handleAutorunCreated(this, debugLocation);\n this._run();\n }\n dispose() {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n for (const o of this._dependencies) {\n o.removeObserver(this); // Warning: external call!\n }\n this._dependencies.clear();\n if (this._store !== undefined) {\n this._store.dispose();\n }\n if (this._delayedStore !== undefined) {\n this._delayedStore.dispose();\n }\n getLogger()?.handleAutorunDisposed(this);\n }\n _run() {\n const emptySet = this._dependenciesToBeRemoved;\n this._dependenciesToBeRemoved = this._dependencies;\n this._dependencies = emptySet;\n this._state = 3 /* AutorunState.upToDate */;\n try {\n if (!this._disposed) {\n getLogger()?.handleAutorunStarted(this);\n const changeSummary = this._changeSummary;\n const delayedStore = this._delayedStore;\n if (delayedStore !== undefined) {\n this._delayedStore = undefined;\n }\n try {\n this._isRunning = true;\n if (this._changeTracker) {\n this._changeTracker.beforeUpdate?.(this, changeSummary);\n this._changeSummary = this._changeTracker.createChangeSummary(changeSummary); // Warning: external call!\n }\n if (this._store !== undefined) {\n this._store.dispose();\n this._store = undefined;\n }\n this._runFn(this, changeSummary); // Warning: external call!\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n finally {\n this._isRunning = false;\n if (delayedStore !== undefined) {\n delayedStore.dispose();\n }\n }\n }\n }\n finally {\n if (!this._disposed) {\n getLogger()?.handleAutorunFinished(this);\n }\n // We don't want our observed observables to think that they are (not even temporarily) not being observed.\n // Thus, we only unsubscribe from observables that are definitely not read anymore.\n for (const o of this._dependenciesToBeRemoved) {\n o.removeObserver(this); // Warning: external call!\n }\n this._dependenciesToBeRemoved.clear();\n }\n }\n toString() {\n return `Autorun<${this.debugName}>`;\n }\n // IObserver implementation\n beginUpdate(_observable) {\n if (this._state === 3 /* AutorunState.upToDate */) {\n this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n this._updateCount++;\n }\n endUpdate(_observable) {\n try {\n if (this._updateCount === 1) {\n do {\n if (this._state === 1 /* AutorunState.dependenciesMightHaveChanged */) {\n this._state = 3 /* AutorunState.upToDate */;\n for (const d of this._dependencies) {\n d.reportChanges(); // Warning: external call!\n if (this._state === 2 /* AutorunState.stale */) {\n // The other dependencies will refresh on demand\n break;\n }\n }\n }\n if (this._state !== 3 /* AutorunState.upToDate */) {\n this._run(); // Warning: indirect external call!\n }\n } while (this._state !== 3 /* AutorunState.upToDate */);\n }\n }\n finally {\n this._updateCount--;\n }\n }\n handlePossibleChange(observable) {\n if (this._state === 3 /* AutorunState.upToDate */ && this._isDependency(observable)) {\n this._state = 1 /* AutorunState.dependenciesMightHaveChanged */;\n }\n }\n handleChange(observable, change) {\n if (this._isDependency(observable)) {\n getLogger()?.handleAutorunDependencyChanged(this, observable, change);\n try {\n // Warning: external call!\n const shouldReact = this._changeTracker ? this._changeTracker.handleChange({\n changedObservable: observable,\n change,\n didChange: (o) => o === observable,\n }, this._changeSummary) : true;\n if (shouldReact) {\n this._state = 2 /* AutorunState.stale */;\n }\n }\n catch (e) {\n onBugIndicatingError(e);\n }\n }\n }\n _isDependency(observable) {\n return this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable);\n }\n // IReader implementation\n _ensureNoRunning() {\n if (!this._isRunning) {\n throw new BugIndicatingError('The reader object cannot be used outside its compute function!');\n }\n }\n readObservable(observable) {\n this._ensureNoRunning();\n // In case the run action disposes the autorun\n if (this._disposed) {\n return observable.get(); // warning: external call!\n }\n observable.addObserver(this); // warning: external call!\n const value = observable.get(); // warning: external call!\n this._dependencies.add(observable);\n this._dependenciesToBeRemoved.delete(observable);\n return value;\n }\n get store() {\n this._ensureNoRunning();\n if (this._disposed) {\n throw new BugIndicatingError('Cannot access store after dispose');\n }\n if (this._store === undefined) {\n this._store = new DisposableStore();\n }\n return this._store;\n }\n get delayedStore() {\n this._ensureNoRunning();\n if (this._disposed) {\n throw new BugIndicatingError('Cannot access store after dispose');\n }\n if (this._delayedStore === undefined) {\n this._delayedStore = new DisposableStore();\n }\n return this._delayedStore;\n }\n debugGetState() {\n return {\n isRunning: this._isRunning,\n updateCount: this._updateCount,\n dependencies: this._dependencies,\n state: this._state,\n stateStr: autorunStateToString(this._state),\n };\n }\n debugRerun() {\n if (!this._isRunning) {\n this._run();\n }\n else {\n this._state = 2 /* AutorunState.stale */;\n }\n }\n}\n\nexport { AutorunObserver };\n//# sourceMappingURL=createEffectImpl.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { toDisposable } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { AutorunObserver } from './createEffectImpl.js';\nimport { DebugLocation } from '../debugLocation.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the effect.\n */\nfunction createEffect(fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(undefined, undefined, fn), fn, undefined, debugLocation);\n}\n/**\n * @deprecated Use {@link createEffect} instead.\n */\nconst autorun = createEffect;\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n */\nfunction createEffectOpts(options, fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, undefined, debugLocation);\n}\n/**\n * @deprecated Use {@link createEffectOpts} instead.\n */\nconst autorunOpts = createEffectOpts;\n/**\n * Runs immediately and whenever a transaction ends and an observed observable changed.\n * {@link fn} should start with a JS Doc using `@description` to name the autorun.\n *\n * Use `changeTracker.createChangeSummary` to create a \"change summary\" that can collect the changes.\n * Use `changeTracker.handleChange` to add a reported change to the change summary.\n * The run function is given the last change summary.\n * The change summary is discarded after the run function was called.\n *\n * @see autorun\n */\nfunction autorunHandleChanges(options, fn, debugLocation = DebugLocation.ofCaller()) {\n return new AutorunObserver(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? fn), fn, options.changeTracker, debugLocation);\n}\n/**\n * @see autorunHandleChanges (but with a disposable store that is cleared before the next run or on dispose)\n */\nfunction autorunWithStoreHandleChanges(options, fn) {\n const store = new DisposableStore();\n const disposable = autorunHandleChanges({\n owner: options.owner,\n debugName: options.debugName,\n debugReferenceFn: options.debugReferenceFn ?? fn,\n changeTracker: options.changeTracker,\n }, (reader, changeSummary) => {\n store.clear();\n fn(reader, changeSummary, store);\n });\n return toDisposable(() => {\n disposable.dispose();\n store.dispose();\n });\n}\n/**\n * @see autorun (but with a disposable store that is cleared before the next run or on dispose)\n *\n * @deprecated Use `autorun(reader => { reader.store.add(...) })` instead!\n */\nfunction autorunWithStore(fn) {\n const store = new DisposableStore();\n const disposable = createEffectOpts({\n owner: undefined,\n debugName: undefined,\n debugReferenceFn: fn,\n }, reader => {\n store.clear();\n fn(reader, store);\n });\n return toDisposable(() => {\n disposable.dispose();\n store.dispose();\n });\n}\nfunction autorunDelta(observable, handler) {\n let _lastValue;\n return createEffectOpts({ debugReferenceFn: handler }, (reader) => {\n const newValue = observable.read(reader);\n const lastValue = _lastValue;\n _lastValue = newValue;\n handler({ lastValue, newValue });\n });\n}\nfunction autorunIterableDelta(getValue, handler, getUniqueIdentifier = v => v) {\n const lastValues = new Map();\n return createEffectOpts({ debugReferenceFn: getValue }, (reader) => {\n const newValues = new Map();\n const removedValues = new Map(lastValues);\n for (const value of getValue(reader)) {\n const id = getUniqueIdentifier(value);\n if (lastValues.has(id)) {\n removedValues.delete(id);\n }\n else {\n newValues.set(id, value);\n lastValues.set(id, value);\n }\n }\n for (const id of removedValues.keys()) {\n lastValues.delete(id);\n }\n if (newValues.size || removedValues.size) {\n handler({ addedValues: [...newValues.values()], removedValues: [...removedValues.values()] });\n }\n });\n}\n/**\n * An autorun with a `dispose()` method on its `reader` which cancels the autorun.\n * It it safe to call `dispose()` synchronously.\n */\nfunction autorunSelfDisposable(fn, debugLocation = DebugLocation.ofCaller()) {\n let ar;\n let disposed = false;\n // eslint-disable-next-line prefer-const\n ar = createEffect(reader => {\n fn({\n delayedStore: reader.delayedStore,\n store: reader.store,\n readObservable: reader.readObservable.bind(reader),\n dispose: () => {\n ar?.dispose();\n disposed = true;\n }\n });\n }, debugLocation);\n if (disposed) {\n ar.dispose();\n }\n return ar;\n}\n\nexport { autorun, autorunDelta, autorunHandleChanges, autorunIterableDelta, autorunOpts, autorunSelfDisposable, autorunWithStore, autorunWithStoreHandleChanges, createEffect, createEffectOpts };\n//# sourceMappingURL=createEffect.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { onUnexpectedError } from './commonFacade/deps.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * This function is used to indicate that the caller recovered from an error that indicates a bug.\n*/\nfunction handleBugIndicatingErrorRecovery(message) {\n const err = new Error('BugIndicatingErrorRecovery: ' + message);\n onUnexpectedError(err);\n console.error('recovered from an error that indicates a bug', err);\n}\n\nexport { handleBugIndicatingErrorRecovery };\n//# sourceMappingURL=base.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { handleBugIndicatingErrorRecovery } from './base.js';\nimport { getFunctionName } from './debugName.js';\nimport { getLogger } from './logging/logging.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Starts a transaction in which many observables can be changed at once.\n * {@link fn} should start with a JS Doc using `@description` to give the transaction a debug name.\n * Reaction run on demand or when the transaction ends.\n */\nfunction transaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n fn(tx);\n }\n finally {\n tx.finish();\n }\n}\nlet _globalTransaction = undefined;\nfunction globalTransaction(fn) {\n if (_globalTransaction) {\n fn(_globalTransaction);\n }\n else {\n const tx = new TransactionImpl(fn, undefined);\n _globalTransaction = tx;\n try {\n fn(tx);\n }\n finally {\n tx.finish(); // During finish, more actions might be added to the transaction.\n // Which is why we only clear the global transaction after finish.\n _globalTransaction = undefined;\n }\n }\n}\n/** @deprecated */\nasync function asyncTransaction(fn, getDebugName) {\n const tx = new TransactionImpl(fn, getDebugName);\n try {\n await fn(tx);\n }\n finally {\n tx.finish();\n }\n}\n/**\n * Allows to chain transactions.\n */\nfunction subtransaction(tx, fn, getDebugName) {\n if (!tx) {\n transaction(fn, getDebugName);\n }\n else {\n fn(tx);\n }\n}\nclass TransactionImpl {\n constructor(_fn, _getDebugName) {\n this._fn = _fn;\n this._getDebugName = _getDebugName;\n this._updatingObservers = [];\n getLogger()?.handleBeginTransaction(this);\n }\n getDebugName() {\n if (this._getDebugName) {\n return this._getDebugName();\n }\n return getFunctionName(this._fn);\n }\n updateObserver(observer, observable) {\n if (!this._updatingObservers) {\n // This happens when a transaction is used in a callback or async function.\n // If an async transaction is used, make sure the promise awaits all users of the transaction (e.g. no race).\n handleBugIndicatingErrorRecovery('Transaction already finished!');\n // Error recovery\n transaction(tx => {\n tx.updateObserver(observer, observable);\n });\n return;\n }\n // When this gets called while finish is active, they will still get considered\n this._updatingObservers.push({ observer, observable });\n observer.beginUpdate(observable);\n }\n finish() {\n const updatingObservers = this._updatingObservers;\n if (!updatingObservers) {\n handleBugIndicatingErrorRecovery('transaction.finish() has already been called!');\n return;\n }\n for (let i = 0; i < updatingObservers.length; i++) {\n const { observer, observable } = updatingObservers[i];\n observer.endUpdate(observable);\n }\n // Prevent anyone from updating observers from now on.\n this._updatingObservers = null;\n getLogger()?.handleEndTransaction(this);\n }\n debugGetUpdatingObservers() {\n return this._updatingObservers;\n }\n}\n\nexport { TransactionImpl, asyncTransaction, globalTransaction, subtransaction, transaction };\n//# sourceMappingURL=transaction.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { TransactionImpl } from '../transaction.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { getLogger } from '../logging/logging.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new ObservableValue(debugNameData, initialValue, strictEquals, debugLocation);\n}\nclass ObservableValue extends BaseObservable {\n get debugName() {\n return this._debugNameData.getDebugName(this) ?? 'ObservableValue';\n }\n constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this._equalityComparator = _equalityComparator;\n this._value = initialValue;\n getLogger()?.handleObservableUpdated(this, { hadValue: false, newValue: initialValue, change: undefined, didChange: true, oldValue: undefined });\n }\n get() {\n return this._value;\n }\n set(value, tx, change) {\n if (change === undefined && this._equalityComparator(this._value, value)) {\n return;\n }\n let _tx;\n if (!tx) {\n tx = _tx = new TransactionImpl(() => { }, () => `Setting ${this.debugName}`);\n }\n try {\n const oldValue = this._value;\n this._setValue(value);\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue: value, change, didChange: true, hadValue: true });\n for (const observer of this._observers) {\n tx.updateObserver(observer, this);\n observer.handleChange(this, change);\n }\n }\n finally {\n if (_tx) {\n _tx.finish();\n }\n }\n }\n toString() {\n return `${this.debugName}: ${this._value}`;\n }\n _setValue(newValue) {\n this._value = newValue;\n }\n debugGetState() {\n return {\n value: this._value,\n };\n }\n debugSetValue(value) {\n this._value = value;\n }\n}\n/**\n * A disposable observable. When disposed, its value is also disposed.\n * When a new value is set, the previous value is disposed.\n */\nfunction disposableObservableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {\n let debugNameData;\n if (typeof nameOrOwner === 'string') {\n debugNameData = new DebugNameData(undefined, nameOrOwner, undefined);\n }\n else {\n debugNameData = new DebugNameData(nameOrOwner, undefined, undefined);\n }\n return new DisposableObservableValue(debugNameData, initialValue, strictEquals, debugLocation);\n}\nclass DisposableObservableValue extends ObservableValue {\n _setValue(newValue) {\n if (this._value === newValue) {\n return;\n }\n if (this._value) {\n this._value.dispose();\n }\n this._value = newValue;\n }\n dispose() {\n this._value?.dispose();\n }\n}\n\nexport { DisposableObservableValue, ObservableValue, disposableObservableValue, observableValue };\n//# sourceMappingURL=observableValue.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { subtransaction } from '../transaction.js';\nimport { strictEquals } from '../commonFacade/deps.js';\nimport { DebugNameData } from '../debugName.js';\nimport { getLogger } from '../logging/logging.js';\nimport { BaseObservable } from './baseObservable.js';\nimport { DebugLocation } from '../debugLocation.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableFromEvent(...args) {\n let owner;\n let event;\n let getValue;\n let debugLocation;\n if (args.length === 2) {\n [event, getValue] = args;\n }\n else {\n [owner, event, getValue, debugLocation] = args;\n }\n return new FromEventObservable(new DebugNameData(owner, undefined, getValue), event, getValue, () => FromEventObservable.globalTransaction, strictEquals, debugLocation ?? DebugLocation.ofCaller());\n}\nfunction observableFromEventOpts(options, event, getValue, debugLocation = DebugLocation.ofCaller()) {\n return new FromEventObservable(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn ?? getValue), event, getValue, () => FromEventObservable.globalTransaction, options.equalsFn ?? strictEquals, debugLocation);\n}\nclass FromEventObservable extends BaseObservable {\n constructor(_debugNameData, event, _getValue, _getTransaction, _equalityComparator, debugLocation) {\n super(debugLocation);\n this._debugNameData = _debugNameData;\n this.event = event;\n this._getValue = _getValue;\n this._getTransaction = _getTransaction;\n this._equalityComparator = _equalityComparator;\n this._hasValue = false;\n this.handleEvent = (args) => {\n const newValue = this._getValue(args);\n const oldValue = this._value;\n const didChange = !this._hasValue || !(this._equalityComparator(oldValue, newValue));\n let didRunTransaction = false;\n if (didChange) {\n this._value = newValue;\n if (this._hasValue) {\n didRunTransaction = true;\n subtransaction(this._getTransaction(), (tx) => {\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });\n for (const o of this._observers) {\n tx.updateObserver(o, this);\n o.handleChange(this, undefined);\n }\n }, () => {\n const name = this.getDebugName();\n return 'Event fired' + (name ? `: ${name}` : '');\n });\n }\n this._hasValue = true;\n }\n if (!didRunTransaction) {\n getLogger()?.handleObservableUpdated(this, { oldValue, newValue, change: undefined, didChange, hadValue: this._hasValue });\n }\n };\n }\n getDebugName() {\n return this._debugNameData.getDebugName(this);\n }\n get debugName() {\n const name = this.getDebugName();\n return 'From Event' + (name ? `: ${name}` : '');\n }\n onFirstObserverAdded() {\n this._subscription = this.event(this.handleEvent);\n }\n onLastObserverRemoved() {\n this._subscription.dispose();\n this._subscription = undefined;\n this._hasValue = false;\n this._value = undefined;\n }\n get() {\n if (this._subscription) {\n if (!this._hasValue) {\n this.handleEvent(undefined);\n }\n return this._value;\n }\n else {\n // no cache, as there are no subscribers to keep it updated\n const value = this._getValue(undefined);\n return value;\n }\n }\n debugSetValue(value) {\n this._value = value;\n }\n debugGetState() {\n return { value: this._value, hasValue: this._hasValue };\n }\n}\n(function (observableFromEvent) {\n observableFromEvent.Observer = FromEventObservable;\n function batchEventsGlobally(tx, fn) {\n let didSet = false;\n if (FromEventObservable.globalTransaction === undefined) {\n FromEventObservable.globalTransaction = tx;\n didSet = true;\n }\n try {\n fn();\n }\n finally {\n if (didSet) {\n FromEventObservable.globalTransaction = undefined;\n }\n }\n }\n observableFromEvent.batchEventsGlobally = batchEventsGlobally;\n})(observableFromEvent || (observableFromEvent = {}));\n\nexport { FromEventObservable, observableFromEvent, observableFromEventOpts };\n//# sourceMappingURL=observableFromEvent.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { createEffect } from '../reactions/createEffect.js';\nimport { transaction } from '../transaction.js';\nimport { observableValue } from '../observables/observableValue.js';\nimport { toDisposable } from '../commonFacade/deps.js';\nimport { derivedOpts, derived } from '../observables/derived.js';\nimport { observableFromEvent } from '../observables/observableFromEvent.js';\nimport { observableSignal } from '../observables/observableSignal.js';\nimport { _setKeepObserved, _setRecomputeInitiallyAndOnChange } from '../observables/baseObservable.js';\nimport { DisposableStore } from '../../disposables.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction observableFromPromise(promise) {\n const observable = observableValue('promiseValue', {});\n promise.then((value) => {\n observable.set({ value }, undefined);\n });\n return observable;\n}\nfunction signalFromObservable(owner, observable) {\n return derivedOpts({\n owner,\n equalsFn: () => false,\n }, reader => {\n observable.read(reader);\n });\n}\n/**\n * @deprecated Use `debouncedObservable` instead.\n */\nfunction debouncedObservableDeprecated(observable, debounceMs, disposableStore) {\n const debouncedObservable = observableValue('debounced', undefined);\n let timeout = undefined;\n disposableStore.add(createEffect(reader => {\n /** @description debounce */\n const value = observable.read(reader);\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n transaction(tx => {\n debouncedObservable.set(value, tx);\n });\n }, debounceMs);\n }));\n return debouncedObservable;\n}\n/**\n * Creates an observable that debounces the input observable.\n */\nfunction debouncedObservable(observable, debounceMs) {\n let hasValue = false;\n let lastValue;\n let timeout = undefined;\n return observableFromEvent(cb => {\n const d = createEffect(reader => {\n const value = observable.read(reader);\n if (!hasValue) {\n hasValue = true;\n lastValue = value;\n }\n else {\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n lastValue = value;\n cb();\n }, debounceMs);\n }\n });\n return {\n dispose() {\n d.dispose();\n hasValue = false;\n lastValue = undefined;\n },\n };\n }, () => {\n if (hasValue) {\n return lastValue;\n }\n else {\n return observable.get();\n }\n });\n}\nfunction wasEventTriggeredRecently(event, timeoutMs, disposableStore) {\n const observable = observableValue('triggeredRecently', false);\n let timeout = undefined;\n disposableStore.add(event(() => {\n observable.set(true, undefined);\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n observable.set(false, undefined);\n }, timeoutMs);\n }));\n return observable;\n}\n/**\n * This makes sure the observable is being observed and keeps its cache alive.\n */\nfunction keepObserved(observable) {\n const o = new KeepAliveObserver(false, undefined);\n observable.addObserver(o);\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setKeepObserved(keepObserved);\n/**\n * This converts the given observable into an autorun.\n */\nfunction recomputeInitiallyAndOnChange(observable, handleValue) {\n const o = new KeepAliveObserver(true, handleValue);\n observable.addObserver(o);\n try {\n o.beginUpdate(observable);\n }\n finally {\n o.endUpdate(observable);\n }\n return toDisposable(() => {\n observable.removeObserver(o);\n });\n}\n_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);\nclass KeepAliveObserver {\n constructor(_forceRecompute, _handleValue) {\n this._forceRecompute = _forceRecompute;\n this._handleValue = _handleValue;\n this._counter = 0;\n }\n beginUpdate(observable) {\n this._counter++;\n }\n endUpdate(observable) {\n if (this._counter === 1 && this._forceRecompute) {\n if (this._handleValue) {\n this._handleValue(observable.get());\n }\n else {\n observable.reportChanges();\n }\n }\n this._counter--;\n }\n handlePossibleChange(observable) {\n // NO OP\n }\n handleChange(observable, change) {\n // NO OP\n }\n}\nfunction derivedObservableWithCache(owner, computeFn) {\n let lastValue = undefined;\n const observable = derivedOpts({ owner, debugReferenceFn: computeFn }, reader => {\n lastValue = computeFn(reader, lastValue);\n return lastValue;\n });\n return observable;\n}\nfunction derivedObservableWithWritableCache(owner, computeFn) {\n let lastValue = undefined;\n const onChange = observableSignal('derivedObservableWithWritableCache');\n const observable = derived(owner, reader => {\n onChange.read(reader);\n lastValue = computeFn(reader, lastValue);\n return lastValue;\n });\n return Object.assign(observable, {\n clearCache: (tx) => {\n lastValue = undefined;\n onChange.trigger(tx);\n },\n setCache: (newValue, tx) => {\n lastValue = newValue;\n onChange.trigger(tx);\n }\n });\n}\n/**\n * When the items array changes, referential equal items are not mapped again.\n */\nfunction mapObservableArrayCached(owner, items, map, keySelector) {\n let m = new ArrayMap(map, keySelector);\n const self = derivedOpts({\n debugReferenceFn: map,\n owner,\n onLastObserverRemoved: () => {\n m.dispose();\n m = new ArrayMap(map);\n }\n }, (reader) => {\n m.setItems(items.read(reader));\n return m.getItems();\n });\n return self;\n}\nclass ArrayMap {\n constructor(_map, _keySelector) {\n this._map = _map;\n this._keySelector = _keySelector;\n this._cache = new Map();\n this._items = [];\n }\n dispose() {\n this._cache.forEach(entry => entry.store.dispose());\n this._cache.clear();\n }\n setItems(items) {\n const newItems = [];\n const itemsToRemove = new Set(this._cache.keys());\n for (const item of items) {\n const key = this._keySelector ? this._keySelector(item) : item;\n let entry = this._cache.get(key);\n if (!entry) {\n const store = new DisposableStore();\n const out = this._map(item, store);\n entry = { out, store };\n this._cache.set(key, entry);\n }\n else {\n itemsToRemove.delete(key);\n }\n newItems.push(entry.out);\n }\n for (const item of itemsToRemove) {\n const entry = this._cache.get(item);\n entry.store.dispose();\n this._cache.delete(item);\n }\n this._items = newItems;\n }\n getItems() {\n return this._items;\n }\n}\n\nexport { KeepAliveObserver, debouncedObservable, debouncedObservableDeprecated, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, mapObservableArrayCached, observableFromPromise, recomputeInitiallyAndOnChange, signalFromObservable, wasEventTriggeredRecently };\n//# sourceMappingURL=utils.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { addLogger } from './logging.js';\nimport { getClassName } from '../debugName.js';\nimport { Derived } from '../observables/derivedImpl.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nlet consoleObservableLogger;\nfunction logObservableToConsole(obs) {\n if (!consoleObservableLogger) {\n consoleObservableLogger = new ConsoleObservableLogger();\n addLogger(consoleObservableLogger);\n }\n consoleObservableLogger.addFilteredObj(obs);\n}\nclass ConsoleObservableLogger {\n constructor() {\n this.indentation = 0;\n this.changedObservablesSets = new WeakMap();\n }\n addFilteredObj(obj) {\n if (!this._filteredObjects) {\n this._filteredObjects = new Set();\n }\n this._filteredObjects.add(obj);\n }\n _isIncluded(obj) {\n return this._filteredObjects?.has(obj) ?? true;\n }\n textToConsoleArgs(text) {\n return consoleTextToArgs([\n normalText(repeat('| ', this.indentation)),\n text,\n ]);\n }\n formatInfo(info) {\n if (!info.hadValue) {\n return [\n normalText(` `),\n styled(formatValue(info.newValue, 60), {\n color: 'green',\n }),\n normalText(` (initial)`),\n ];\n }\n return info.didChange\n ? [\n normalText(` `),\n styled(formatValue(info.oldValue, 70), {\n color: 'red',\n strikeThrough: true,\n }),\n normalText(` `),\n styled(formatValue(info.newValue, 60), {\n color: 'green',\n }),\n ]\n : [normalText(` (unchanged)`)];\n }\n handleObservableCreated(observable) {\n if (observable instanceof Derived) {\n const derived = observable;\n this.changedObservablesSets.set(derived, new Set());\n }\n }\n handleOnListenerCountChanged(observable, newCount) {\n }\n handleObservableUpdated(observable, info) {\n if (!this._isIncluded(observable)) {\n return;\n }\n if (observable instanceof Derived) {\n this._handleDerivedRecomputed(observable, info);\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('observable value changed'),\n styled(observable.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n ]));\n }\n formatChanges(changes) {\n if (changes.size === 0) {\n return undefined;\n }\n return styled(' (changed deps: ' +\n [...changes].map((o) => o.debugName).join(', ') +\n ')', { color: 'gray' });\n }\n handleDerivedDependencyChanged(derived, observable, change) {\n if (!this._isIncluded(derived)) {\n return;\n }\n this.changedObservablesSets.get(derived)?.add(observable);\n }\n _handleDerivedRecomputed(derived, info) {\n if (!this._isIncluded(derived)) {\n return;\n }\n const changedObservables = this.changedObservablesSets.get(derived);\n if (!changedObservables) {\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('derived recomputed'),\n styled(derived.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n this.formatChanges(changedObservables),\n { data: [{ fn: derived._debugNameData.referenceFn ?? derived._computeFn }] }\n ]));\n changedObservables.clear();\n }\n handleDerivedCleared(derived) {\n if (!this._isIncluded(derived)) {\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('derived cleared'),\n styled(derived.debugName, { color: 'BlueViolet' }),\n ]));\n }\n handleFromEventObservableTriggered(observable, info) {\n if (!this._isIncluded(observable)) {\n return;\n }\n console.log(...this.textToConsoleArgs([\n formatKind('observable from event triggered'),\n styled(observable.debugName, { color: 'BlueViolet' }),\n ...this.formatInfo(info),\n { data: [{ fn: observable._getValue }] }\n ]));\n }\n handleAutorunCreated(autorun) {\n if (!this._isIncluded(autorun)) {\n return;\n }\n this.changedObservablesSets.set(autorun, new Set());\n }\n handleAutorunDisposed(autorun) {\n }\n handleAutorunDependencyChanged(autorun, observable, change) {\n if (!this._isIncluded(autorun)) {\n return;\n }\n this.changedObservablesSets.get(autorun).add(observable);\n }\n handleAutorunStarted(autorun) {\n const changedObservables = this.changedObservablesSets.get(autorun);\n if (!changedObservables) {\n return;\n }\n if (this._isIncluded(autorun)) {\n console.log(...this.textToConsoleArgs([\n formatKind('autorun'),\n styled(autorun.debugName, { color: 'BlueViolet' }),\n this.formatChanges(changedObservables),\n { data: [{ fn: autorun._debugNameData.referenceFn ?? autorun._runFn }] }\n ]));\n }\n changedObservables.clear();\n this.indentation++;\n }\n handleAutorunFinished(autorun) {\n this.indentation--;\n }\n handleBeginTransaction(transaction) {\n let transactionName = transaction.getDebugName();\n if (transactionName === undefined) {\n transactionName = '';\n }\n if (this._isIncluded(transaction)) {\n console.log(...this.textToConsoleArgs([\n formatKind('transaction'),\n styled(transactionName, { color: 'BlueViolet' }),\n { data: [{ fn: transaction._fn }] }\n ]));\n }\n this.indentation++;\n }\n handleEndTransaction() {\n this.indentation--;\n }\n}\nfunction consoleTextToArgs(text) {\n const styles = new Array();\n const data = [];\n let firstArg = '';\n function process(t) {\n if ('length' in t) {\n for (const item of t) {\n if (item) {\n process(item);\n }\n }\n }\n else if ('text' in t) {\n firstArg += `%c${t.text}`;\n styles.push(t.style);\n if (t.data) {\n data.push(...t.data);\n }\n }\n else if ('data' in t) {\n data.push(...t.data);\n }\n }\n process(text);\n const result = [firstArg, ...styles];\n result.push(...data);\n return result;\n}\nfunction normalText(text) {\n return styled(text, { color: 'black' });\n}\nfunction formatKind(kind) {\n return styled(padStr(`${kind}: `, 10), { color: 'black', bold: true });\n}\nfunction styled(text, options = {\n color: 'black',\n}) {\n function objToCss(styleObj) {\n return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => {\n return `${styleString}${propName}:${propValue};`;\n }, '');\n }\n const style = {\n color: options.color,\n };\n if (options.strikeThrough) {\n style['text-decoration'] = 'line-through';\n }\n if (options.bold) {\n style['font-weight'] = 'bold';\n }\n return {\n text,\n style: objToCss(style),\n };\n}\nfunction formatValue(value, availableLen) {\n try {\n return formatValueUnsafe(value, availableLen);\n }\n catch {\n // Value could not be formatted (e.g., a Proxy that throws on coercion)\n return '[[???]]';\n }\n}\nfunction formatValueUnsafe(value, availableLen) {\n switch (typeof value) {\n case 'number':\n return '' + value;\n case 'string':\n if (value.length + 2 <= availableLen) {\n return `\"${value}\"`;\n }\n return `\"${value.substr(0, availableLen - 7)}\"+...`;\n case 'boolean':\n return value ? 'true' : 'false';\n case 'undefined':\n return 'undefined';\n case 'object':\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return formatArray(value, availableLen);\n }\n return formatObject(value, availableLen);\n case 'symbol':\n return value.toString();\n case 'function':\n return `[[Function${value.name ? ' ' + value.name : ''}]]`;\n default:\n return '' + value;\n }\n}\nfunction formatArray(value, availableLen) {\n let result = '[ ';\n let first = true;\n for (const val of value) {\n if (!first) {\n result += ', ';\n }\n if (result.length - 5 > availableLen) {\n result += '...';\n break;\n }\n first = false;\n result += `${formatValue(val, availableLen - result.length)}`;\n }\n result += ' ]';\n return result;\n}\nfunction formatObject(value, availableLen) {\n // Avoid drilling into Proxies - wrap operations that could trigger traps\n try {\n if (typeof value.toString === 'function' && value.toString !== Object.prototype.toString) {\n const val = value.toString();\n if (val.length <= availableLen) {\n return val;\n }\n return val.substring(0, availableLen - 3) + '...';\n }\n }\n catch {\n // toString triggered a Proxy trap or threw - bail out\n return '[[Object]]';\n }\n const className = getClassName(value);\n let result = className ? className + '(' : '{ ';\n let first = true;\n let entries;\n try {\n entries = Object.entries(value);\n }\n catch {\n // Object.entries triggered a Proxy trap - bail out\n return className ? `${className}(...)` : '[[Object]]';\n }\n for (const [key, val] of entries) {\n if (!first) {\n result += ', ';\n }\n if (result.length - 5 > availableLen) {\n result += '...';\n break;\n }\n first = false;\n result += `${key}: ${formatValue(val, availableLen - result.length)}`;\n }\n result += className ? ')' : ' }';\n return result;\n}\nfunction repeat(str, count) {\n let result = '';\n for (let i = 1; i <= count; i++) {\n result += str;\n }\n return result;\n}\nfunction padStr(str, length) {\n while (str.length < length) {\n str += ' ';\n }\n return str;\n}\n\nexport { ConsoleObservableLogger, formatValue, logObservableToConsole };\n//# sourceMappingURL=consoleObservableLogger.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { Derived } from '../observables/derivedImpl.js';\nimport { FromEventObservable } from '../observables/observableFromEvent.js';\nimport { ObservableValue } from '../observables/observableValue.js';\nimport { AutorunObserver } from '../reactions/createEffectImpl.js';\nimport { formatValue } from './consoleObservableLogger.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nfunction debugGetDependencyGraph(obs, options) {\n const debugNamePostProcessor = options?.debugNamePostProcessor ?? ((str) => str);\n const info = Info.from(obs, debugNamePostProcessor);\n if (!info) {\n return '';\n }\n const alreadyListed = new Set();\n return formatObservableInfo(info, 0, alreadyListed).trim();\n}\nfunction formatObservableInfo(info, indentLevel, alreadyListed) {\n const indent = '\\t\\t'.repeat(indentLevel);\n const lines = [];\n const isAlreadyListed = alreadyListed.has(info.sourceObj);\n if (isAlreadyListed) {\n lines.push(`${indent}* ${info.type} ${info.name} (already listed)`);\n return lines.join('\\n');\n }\n alreadyListed.add(info.sourceObj);\n lines.push(`${indent}* ${info.type} ${info.name}:`);\n lines.push(`${indent} value: ${formatValue(info.value, 50)}`);\n lines.push(`${indent} state: ${info.state}`);\n if (info.dependencies.length > 0) {\n lines.push(`${indent} dependencies:`);\n for (const dep of info.dependencies) {\n lines.push(formatObservableInfo(dep, indentLevel + 1, alreadyListed));\n }\n }\n return lines.join('\\n');\n}\nclass Info {\n static from(obs, debugNamePostProcessor) {\n if (obs instanceof AutorunObserver) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'autorun', undefined, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));\n }\n else if (obs instanceof Derived) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'derived', state.value, state.stateStr, Array.from(state.dependencies).map(dep => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));\n }\n else if (obs instanceof ObservableValue) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'observableValue', state.value, 'upToDate', []);\n }\n else if (obs instanceof FromEventObservable) {\n const state = obs.debugGetState();\n return new Info(obs, debugNamePostProcessor(obs.debugName), 'fromEvent', state.value, state.hasValue ? 'upToDate' : 'initial', []);\n }\n return undefined;\n }\n static unknown(obs) {\n return new Info(obs, '(unknown)', 'unknown', undefined, 'unknown', []);\n }\n constructor(sourceObj, name, type, value, state, dependencies) {\n this.sourceObj = sourceObj;\n this.name = name;\n this.type = type;\n this.value = value;\n this.state = state;\n this.dependencies = dependencies;\n }\n}\n\nexport { debugGetDependencyGraph };\n//# sourceMappingURL=debugGetDependencyGraph.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { setLogObservableFn } from './logging/logging.js';\nimport { _setDebugGetDependencyGraph } from './observables/baseObservable.js';\nexport { DebugLocation } from './debugLocation.js';\nexport { derived, derivedDisposable, derivedHandleChanges, derivedOpts, derivedWithSetter, derivedWithStore } from './observables/derived.js';\nexport { debouncedObservable, debouncedObservableDeprecated, derivedObservableWithCache, derivedObservableWithWritableCache, keepObserved, mapObservableArrayCached, observableFromPromise, recomputeInitiallyAndOnChange, signalFromObservable, wasEventTriggeredRecently } from './utils/utils.js';\nexport { observableFromEvent, observableFromEventOpts } from './observables/observableFromEvent.js';\nimport { logObservableToConsole } from './logging/consoleObservableLogger.js';\nimport { debugGetDependencyGraph } from './logging/debugGetDependencyGraph.js';\n\n/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n// This is a facade for the observable implementation. Only import from here!\n_setDebugGetDependencyGraph(debugGetDependencyGraph);\nsetLogObservableFn(logObservableToConsole);\n//# sourceMappingURL=index.js.map\n","import type { IJsonSchema } from './fixtureApi.js';\n\n/**\n * A single input property shared by one or more of the currently rendered fixtures.\n * Properties are grouped by name **and** structural schema equality, so a control can edit\n * every fixture that declares the same property at once.\n */\nexport interface AggregatedInputProperty {\n readonly name: string;\n readonly schema: IJsonSchema;\n /** Ids of the fixtures that declare this exact property (same name + schema). */\n readonly fixtureIds: readonly string[];\n}\n\n/** Minimal shape needed to aggregate: a fixture id and its (merged) input schema. */\nexport interface ComponentInputInfo {\n readonly id: string;\n readonly inputSchema?: IJsonSchema;\n}\n\n/** Deterministic stringify (object keys sorted) for structural schema equality. */\nfunction stableStringify(value: unknown): string {\n if (value === null || typeof value !== 'object') {\n return JSON.stringify(value) ?? 'null';\n }\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(',')}]`;\n }\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, v]) => v !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(',')}}`;\n}\n\n/**\n * Stable identity of an input property: its name plus structural schema. Two fixtures that\n * declare the same property (same name + schema) share this key, so a chosen value can be\n * persisted once and reused across every fixture that has it.\n */\nexport function inputPropertyKey(name: string, schema: IJsonSchema): string {\n return `${name}\\u0000${stableStringify(schema)}`;\n}\n\n/**\n * Collects the input properties declared across the given fixtures, grouping identical\n * (name + schema) properties so they can be edited together. Order follows first appearance.\n */\nexport function aggregateInputProperties(\n components: readonly ComponentInputInfo[],\n): AggregatedInputProperty[] {\n const groups = new Map<string, { name: string; schema: IJsonSchema; fixtureIds: string[] }>();\n const order: string[] = [];\n\n for (const component of components) {\n const properties = component.inputSchema?.properties;\n if (!properties) { continue; }\n for (const [name, schema] of Object.entries(properties)) {\n if (!schema || typeof schema !== 'object') { continue; }\n const key = inputPropertyKey(name, schema);\n let group = groups.get(key);\n if (!group) {\n group = { name, schema, fixtureIds: [] };\n groups.set(key, group);\n order.push(key);\n }\n if (!group.fixtureIds.includes(component.id)) {\n group.fixtureIds.push(component.id);\n }\n }\n }\n\n return order.map((key) => {\n const g = groups.get(key)!;\n return { name: g.name, schema: g.schema, fixtureIds: g.fixtureIds };\n });\n}\n\n/** The value currently in effect for a property: explicit override, else schema default. */\nexport function effectiveInputValue(\n override: Record<string, unknown> | undefined,\n name: string,\n schema: IJsonSchema,\n): unknown {\n if (override && Object.prototype.hasOwnProperty.call(override, name)) {\n return override[name];\n }\n return schema.default;\n}\n","import { observableValue, derived, type ISettableObservable, type IObservable, type IReader } from '@vscode/observables';\nimport type { IJsonSchema } from './fixtureApi.js';\nimport { inputPropertyKey } from './inputAggregation.js';\n\n/** A fixture's input override object (only the keys the user explicitly changed). */\nexport type FixtureInputOverride = Record<string, unknown>;\n\nconst STORAGE_KEY = 'component-explorer:inputValues';\n\n/**\n * Central store of `input` overrides for the explorer UI.\n *\n * Values are keyed by **property identity** (name + structural schema), not by fixture, so a\n * value chosen on one fixture is automatically reused by every other fixture that declares the\n * same input — navigating between fixtures keeps the shared value instead of resetting it.\n * The whole map is persisted to `localStorage` so choices survive reloads. Schema defaults are\n * applied at render time (see `applyInputDefaults`); only explicit overrides are stored here.\n */\nexport class FixtureInputStore {\n /** Shared values keyed by `inputPropertyKey(name, schema)`. */\n private readonly _values: ISettableObservable<Record<string, unknown>>;\n /** Cache of derived per-fixture override observables. */\n private readonly _byFixture = new Map<string, IObservable<FixtureInputOverride>>();\n\n constructor() {\n this._values = observableValue<Record<string, unknown>>('fixtureInputValues', this._load());\n }\n\n /**\n * Returns a derived observable of `fixtureId`'s input overrides, mapped from the shared\n * per-property store. Only properties the user explicitly set (across any fixture) appear.\n */\n getInput(fixtureId: string, schema: IJsonSchema | undefined): IObservable<FixtureInputOverride> {\n let obs = this._byFixture.get(fixtureId);\n if (!obs) {\n obs = derived((reader) => {\n const values = this._values.read(reader);\n const result: FixtureInputOverride = {};\n const properties = schema?.properties;\n if (properties) {\n for (const [name, propSchema] of Object.entries(properties)) {\n if (!propSchema || typeof propSchema !== 'object') { continue; }\n const key = inputPropertyKey(name, propSchema);\n if (Object.prototype.hasOwnProperty.call(values, key)) {\n result[name] = values[key];\n }\n }\n }\n return result;\n });\n this._byFixture.set(fixtureId, obs);\n }\n return obs;\n }\n\n /** The currently effective value of a shared property: explicit override, else schema default. */\n readValue(reader: IReader, name: string, schema: IJsonSchema): unknown {\n const values = this._values.read(reader);\n const key = inputPropertyKey(name, schema);\n if (Object.prototype.hasOwnProperty.call(values, key)) {\n return values[key];\n }\n return schema.default;\n }\n\n /** Sets a shared input property (applies to every fixture that declares it) and persists. */\n setValue(name: string, schema: IJsonSchema, value: unknown): void {\n const key = inputPropertyKey(name, schema);\n const next = { ...this._values.get(), [key]: value };\n this._values.set(next, undefined);\n this._persist(next);\n }\n\n private _load(): Record<string, unknown> {\n try {\n const raw = localStorage.getItem(STORAGE_KEY);\n if (raw) {\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n }\n } catch {\n /* ignore malformed/inaccessible storage */\n }\n return {};\n }\n\n private _persist(value: Record<string, unknown>): void {\n try {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(value));\n } catch {\n /* ignore storage failures */\n }\n }\n}\n","export class FixturePath {\n private _segments: readonly string[] | undefined;\n\n constructor(readonly value: string) {}\n\n get segments(): readonly string[] {\n return (this._segments ??= this.value.split('/'));\n }\n\n toString(): string {\n return this.value;\n }\n}\n","/**\n * Disposable resource that can be cleaned up.\n */\nexport interface Disposable {\n dispose(): void;\n}\n\n/**\n * Style definition for shadow DOM injection.\n */\nexport type StyleDefinition =\n | { readonly type: 'css'; readonly content: string }\n | { readonly type: 'url'; readonly href: string }\n | { readonly type: 'adopted'; readonly sheet: CSSStyleSheet };\n\n/**\n * Display mode for a component.\n */\nexport type DisplayMode = PageMode | ComponentMode;\n\n/**\n * Page mode - component fills a viewport with device presets.\n */\nexport interface PageMode {\n readonly type: 'page';\n /**\n * Device presets or custom viewport sizes.\n * When viewing, user can switch between these.\n */\n readonly viewports: ViewportPreset[];\n}\n\n/**\n * Component mode - renders at natural size.\n */\nexport interface ComponentMode {\n readonly type: 'component';\n}\n\n/**\n * Viewport preset - either a named preset or custom dimensions.\n */\nexport type ViewportPreset =\n | ViewportPresetName\n | { readonly name: string; readonly width: number; readonly height: number };\n\nexport type ViewportPresetName = 'mobile' | 'tablet' | 'desktop';\n\n/**\n * Standard viewport dimensions for presets.\n */\nexport const VIEWPORT_SIZES: Record<ViewportPresetName, { readonly width: number; readonly height: number }> = {\n mobile: { width: 390, height: 844 },\n tablet: { width: 768, height: 1024 },\n desktop: { width: 1440, height: 900 },\n};\n\n/**\n * Resolves a viewport preset to actual dimensions.\n */\nexport function resolveViewport(preset: ViewportPreset): { name: string; width: number; height: number } {\n if (typeof preset === 'string') {\n return { name: preset, ...VIEWPORT_SIZES[preset] };\n }\n return preset;\n}\n","import type { FixtureExport, IJsonSchema } from './fixtureApi.js';\nimport {\n isSingleFixture,\n isFixtureGroup,\n isFixtureVariants,\n createComponentDefinition,\n mergeInputSchemas,\n type ComponentDefinition,\n} from './fixtureApiConsumer.js';\nimport { FixturePath } from './FixturePath.js';\n\n/**\n * Validates a fixture path option.\n * @throws Error if path contains empty segments\n */\nfunction validatePath(path: string): void {\n if (path.startsWith('/')) {\n throw new Error(`Fixture path cannot start with '/': ${path}`);\n }\n if (path.includes('//')) {\n throw new Error(`Fixture path cannot contain empty segments: ${path}`);\n }\n if (path === '') {\n throw new Error(`Fixture path cannot be empty (use undefined for default)`);\n }\n}\n\n/**\n * Computes the tree path segments for a fixture.\n * @param filePath The file path of the fixture\n * @param pathOption The path option from the fixture export\n * @returns Array of path segments for the tree\n */\nfunction computePathSegments(filePath: string, pathOption: string | undefined): string[] {\n const baseName = extractBaseName(filePath);\n\n if (pathOption === undefined) {\n // No path → just filename\n return [baseName];\n } else if (pathOption.endsWith('/')) {\n // Trailing / → prefix, append filename\n const prefix = pathOption.slice(0, -1);\n if (prefix) {\n validatePath(prefix);\n return [...prefix.split('/'), baseName];\n }\n // Edge case: path is just \"/\" - invalid\n throw new Error(`Fixture path cannot be just '/': ${pathOption}`);\n } else {\n // Exact path, no filename appended\n validatePath(pathOption);\n return pathOption.split('/');\n }\n}\n\n/**\n * A node in the fixture tree.\n * Can be a folder (with children), variants (with children, horizontal layout), or a component leaf.\n */\nexport interface FixtureNode {\n readonly id: FixturePath;\n\n /** Display name */\n readonly name: string;\n\n /** Node type: folder for groups, variants for horizontal variant display, component for leaves */\n readonly type: 'folder' | 'variants' | 'component';\n\n /** Children (for folders and variants) */\n readonly children?: readonly FixtureNode[];\n\n /** Component definition (only for component nodes) */\n readonly component?: ComponentDefinition;\n\n /** Labels for categorization and filtering */\n readonly labels: readonly string[];\n\n /** Source fixture file path — present on skeleton nodes (component is undefined) for on-demand loading */\n readonly sourceFile?: string;\n}\n\n/**\n * Creates a fixture tree from a map of fixture exports.\n * Entries with `undefined` value are rendered as skeleton nodes (loaded on demand).\n */\nexport function createFixtureTree(fixtures: Map<string, FixtureExport>): FixtureNode {\n const root: MutableFixtureNode = {\n id: new FixturePath(''),\n name: 'Components',\n type: 'folder',\n children: [],\n labels: [],\n };\n\n for (const [filePath, fixtureExport] of fixtures) {\n if (fixtureExport === undefined) {\n // Skeleton: module not yet loaded — place a placeholder node using the file basename\n const name = extractBaseName(filePath);\n const skeletonNode: MutableFixtureNode = {\n id: new FixturePath(name),\n name,\n type: 'component',\n labels: [],\n sourceFile: filePath,\n };\n if (!root.children) root.children = [];\n root.children.push(skeletonNode);\n } else {\n const pathOption = '_path' in fixtureExport ? fixtureExport._path : undefined;\n const segments = computePathSegments(filePath, pathOption);\n addFixtureExportToTree(root, segments, fixtureExport, [], filePath);\n }\n }\n\n return root;\n}\n\n/**\n * Resolves all lazy fixture module loaders in parallel and returns a map of loaded exports.\n * Used by modes that need the full fixture tree upfront (headless, embedded).\n */\nexport async function resolveFixtureModules(\n modules: Record<string, () => Promise<{ default?: unknown }>>\n): Promise<Map<string, FixtureExport>> {\n const result = new Map<string, FixtureExport>();\n await Promise.all(\n Object.entries(modules).map(async ([path, loader]) => {\n const mod = await loader();\n const fixture = mod.default;\n if (fixture && typeof fixture === 'object') {\n result.set(path, fixture as FixtureExport);\n }\n })\n );\n return result;\n}\n\ninterface MutableFixtureNode {\n id: FixturePath;\n name: string;\n type: 'folder' | 'variants' | 'component';\n children?: MutableFixtureNode[];\n component?: ComponentDefinition;\n labels: string[];\n sourceFile?: string;\n}\n\nfunction extractBaseName(filePath: string): string {\n const fileName = filePath.split('/').pop() ?? filePath;\n // Remove .fixture.tsx, .fixture.ts, .fixture.jsx, .fixture.js\n return fileName.replace(/\\.fixture\\.(tsx?|jsx?)$/, '');\n}\n\nfunction addFixtureExportToTree(\n parent: MutableFixtureNode,\n pathSegments: string[],\n fixtureExport: FixtureExport,\n pathPrefix: string[] = [],\n sourceFile: string = '',\n inheritedVisualDescriptions: readonly string[] = [],\n inheritedInputSchema: IJsonSchema | undefined = undefined,\n): void {\n // Navigate/create folders for all segments except the last\n let current = parent;\n const accumulatedPath = [...pathPrefix];\n\n for (let i = 0; i < pathSegments.length - 1; i++) {\n const folderName = pathSegments[i];\n accumulatedPath.push(folderName);\n const folderId = new FixturePath(accumulatedPath.join('/'));\n\n let folder = current.children?.find(\n (c) => c.type === 'folder' && c.name === folderName\n );\n\n if (!folder) {\n folder = {\n id: folderId,\n name: folderName,\n type: 'folder',\n children: [],\n labels: [],\n };\n if (!current.children) {\n current.children = [];\n }\n current.children.push(folder);\n }\n current = folder;\n }\n\n // Now add the fixture at the final segment\n const finalSegment = pathSegments[pathSegments.length - 1];\n accumulatedPath.push(finalSegment);\n const fullId = new FixturePath(accumulatedPath.join('/'));\n\n if (isSingleFixture(fixtureExport)) {\n // Single fixture - add as leaf\n const def = createComponentDefinition(fixtureExport, fullId.value, finalSegment, sourceFile, inheritedVisualDescriptions, inheritedInputSchema);\n const componentNode: MutableFixtureNode = {\n id: fullId,\n name: finalSegment,\n type: 'component',\n component: def,\n labels: [...def.labels],\n };\n if (!current.children) {\n current.children = [];\n }\n current.children.push(componentNode);\n } else if (isFixtureGroup(fixtureExport)) {\n // Fixture group - create folder and recurse for entries\n let folder = current.children?.find(\n (c) => c.type === 'folder' && c.name === finalSegment\n );\n\n if (!folder) {\n folder = {\n id: fullId,\n name: finalSegment,\n type: 'folder',\n children: [],\n labels: [...(fixtureExport._labels ?? [])],\n };\n if (!current.children) {\n current.children = [];\n }\n current.children.push(folder);\n }\n\n // Add each entry in the group - recurse with accumulated path as prefix\n for (const [key, entry] of Object.entries(fixtureExport._entries)) {\n const own = fixtureExport._expectedVisualDescriptions;\n const ownArr = own ? (typeof own === 'string' ? [own] : [...own]) : [];\n const groupVisualDescriptions = [...inheritedVisualDescriptions, ...ownArr];\n const groupInputSchema = mergeInputSchemas(inheritedInputSchema, fixtureExport._inputSchemaJson);\n addFixtureExportToTree(folder, [key], entry, accumulatedPath, sourceFile, groupVisualDescriptions, groupInputSchema);\n }\n } else if (isFixtureVariants(fixtureExport)) {\n // Fixture variants - create variants node with children\n const variantsNode: MutableFixtureNode = {\n id: fullId,\n name: finalSegment,\n type: 'variants',\n children: [],\n labels: [...(fixtureExport._labels ?? [])],\n };\n\n if (!current.children) {\n current.children = [];\n }\n current.children.push(variantsNode);\n\n // Add each variant as a child component\n for (const [key, variant] of Object.entries(fixtureExport._variants)) {\n const own = fixtureExport._expectedVisualDescriptions;\n const ownArr = own ? (typeof own === 'string' ? [own] : [...own]) : [];\n const variantVisualDescriptions = [...inheritedVisualDescriptions, ...ownArr];\n const variantInputSchema = mergeInputSchemas(inheritedInputSchema, fixtureExport._inputSchemaJson);\n const childId = new FixturePath([...accumulatedPath, key].join('/'));\n const componentNode: MutableFixtureNode = {\n id: childId,\n name: key,\n type: 'component',\n component: createComponentDefinition(variant, childId.value, key, sourceFile, variantVisualDescriptions, variantInputSchema),\n labels: [...(variant._options.labels ?? [])],\n };\n variantsNode.children!.push(componentNode);\n }\n }\n}\n\n/**\n * Finds a node in the tree by path.\n */\nexport function findNodeByPath(root: FixtureNode, path: string[]): FixtureNode | undefined {\n if (path.length === 0) {\n return root;\n }\n\n let current: FixtureNode | undefined = root;\n\n for (const segment of path) {\n if (!current || !current.children) {\n return undefined;\n }\n current = current.children.find((c) => c.name === segment);\n }\n\n return current;\n}\n\n/**\n * Collects all component nodes from a subtree.\n */\nexport function collectComponents(node: FixtureNode): ComponentDefinition[] {\n if (node.type === 'component' && node.component) {\n return [node.component];\n }\n\n const components: ComponentDefinition[] = [];\n for (const child of node.children ?? []) {\n components.push(...collectComponents(child));\n }\n return components;\n}\n","import { observableValue, derived, type IObservable, type IReader } from '@vscode/observables';\nimport type { FixtureExport } from './fixtureApi.js';\nimport { type ComponentDefinition } from './fixtureApiConsumer.js';\nimport { createFixtureTree, findNodeByPath, type FixtureNode } from './FixtureNode.js';\n\nexport class FixtureRegistry {\n private readonly _fixtures = observableValue<Map<string, FixtureExport>>(this, new Map());\n readonly loading = observableValue<boolean>(this, false);\n readonly error = observableValue<string | undefined>(this, undefined);\n\n readonly root: IObservable<FixtureNode> = derived(this, (reader) => {\n const fixtures = this._fixtures.read(reader);\n return createFixtureTree(fixtures);\n });\n\n register(path: string, fixtureExport: FixtureExport): void {\n const fixtures = new Map(this._fixtures.get());\n fixtures.set(path, fixtureExport);\n this._fixtures.set(fixtures, undefined);\n }\n\n unregister(path: string): void {\n const fixtures = new Map(this._fixtures.get());\n if (fixtures.delete(path)) {\n this._fixtures.set(fixtures, undefined);\n }\n }\n\n clear(): void {\n this._fixtures.set(new Map(), undefined);\n }\n\n getNode(reader: IReader, path: string[]): FixtureNode | undefined {\n const root = this.root.read(reader);\n return findNodeByPath(root, path);\n }\n\n getComponentByPath(path: string[]): ComponentDefinition | undefined {\n const fixtures = this._fixtures.get();\n const tree = createFixtureTree(fixtures);\n const node = findNodeByPath(tree, path);\n return node?.component;\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nclass ManualChangesHandler {\n constructor(_run) {\n this._run = _run;\n this._changes = [];\n this._map = new Map();\n this._updateCounter = 0;\n }\n addDependency(observable, data) {\n this._map.set(observable, data);\n observable.addObserver(this);\n return {\n dispose: () => {\n this._map.delete(observable);\n observable.removeObserver(this);\n }\n };\n }\n beginUpdate(observable) {\n this._updateCounter++;\n this._changes.push(this._map.get(observable));\n }\n endUpdate(_observable) {\n this._updateCounter--;\n if (this._updateCounter === 0) {\n if (this._changes.length > 0) {\n const c = this._changes;\n this._changes = [];\n this._run(c);\n }\n }\n }\n handlePossibleChange(observable) {\n this._changes.push(this._map.get(observable));\n }\n handleChange(_observable, _change) {\n //this._changes.push(this._map.get(observable)!);\n }\n}\n\nexport { ManualChangesHandler };\n//# sourceMappingURL=ManualChangesHandler.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { derived } from '@vscode/observables';\n\n/**\n * Takes a value of type `T` and makes it available as `IObservable<T>`.\n * When it changes, the component will not re-render.\n */\nfunction prop() {\n return PropertyTransformerFactory.instance;\n}\n/**\n * Takes a value of type `T` and makes it available as `T`.\n * When it changes, the component will re-render.\n */\nfunction propConst() {\n return PropertyConstTransformerFactory.instance;\n}\n/**\n * Takes a value of type `T` or `IObservable<T>` and makes it available as `IObservable<T>`.\n * When it changes, the component will not re-render.\n */\nfunction propObs() {\n return PropertyObsTransformerFactory.instance;\n}\nprop.const = propConst;\nprop.obs = propObs;\nclass PropertyTransformerFactory {\n create(readableProp) {\n const d = derived(reader => readableProp(reader));\n return { read: (_reader) => d };\n }\n}\nPropertyTransformerFactory.instance = new PropertyTransformerFactory();\nclass PropertyConstTransformerFactory {\n create(readableProp) {\n const d = derived(reader => readableProp(reader));\n return { read: (reader) => d.read(reader) };\n }\n}\nPropertyConstTransformerFactory.instance = new PropertyConstTransformerFactory();\nclass PropertyObsTransformerFactory {\n create(readableProp) {\n const d = derived(reader => {\n const v = readableProp(reader);\n if (isObservable(v)) {\n return v.read(reader);\n }\n else {\n return v;\n }\n });\n return { read: (_reader) => d };\n }\n}\nPropertyObsTransformerFactory.instance = new PropertyObsTransformerFactory();\nfunction isObservable(obs) {\n return typeof obs === \"object\" && obs !== null && \"read\" in obs;\n}\n\nexport { prop };\n//# sourceMappingURL=IPropertyTransformer.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n/**\n * Maps over an object's values, returning a new object with the same keys\n * but transformed values.\n */\nfunction mapObject(obj, fn) {\n return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value, key)]));\n}\n\nexport { mapObject };\n//# sourceMappingURL=utils.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { DisposableStore } from '@vscode/observables';\nimport { createContext } from 'react';\n\n// Symbol to store the context on the ViewModel class\nconst ViewModelContextSymbol = Symbol('ViewModelContext');\nclass BaseViewModel {\n constructor(props) {\n this._store = new DisposableStore();\n this.props = props;\n }\n dispose() {\n this._store.dispose();\n }\n}\n/** Get or create the context for a ViewModel class */\nfunction getOrCreateViewModelContext(ctor) {\n if (!ctor[ViewModelContextSymbol]) {\n ctor[ViewModelContextSymbol] =\n createContext(undefined);\n }\n return ctor[ViewModelContextSymbol];\n}\nfunction ViewModel(props = {}) {\n var _a;\n return _a = class extends BaseViewModel {\n },\n _a._props = props,\n _a;\n}\n\nexport { BaseViewModel, ViewModel, ViewModelContextSymbol, getOrCreateViewModelContext };\n//# sourceMappingURL=viewModel.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { useReducer, useState, useContext, useEffect } from 'react';\nimport { observableValue, derived } from '@vscode/observables';\nimport { ManualChangesHandler } from './ManualChangesHandler.js';\nimport { unstable_batchedUpdates } from 'react-dom';\n\nlet renderingCount = 0;\nconst batchedUpdater = new ManualChangesHandler(potentialChanges => {\n for (const change of potentialChanges) {\n change.rendered = false;\n }\n if (renderingCount > 0) {\n const rendering = potentialChanges.find(c => c.isRendering);\n rendering.itemsToRender = potentialChanges;\n }\n else {\n unstable_batchedUpdates(() => {\n for (const change of potentialChanges) {\n if (!change.rendered) {\n change.forceUpdate();\n }\n }\n });\n }\n});\nlet viewIdx = 0;\nclass ViewImpl {\n constructor(debugName, renderFactory) {\n this.debugName = debugName;\n this.renderFactory = renderFactory;\n this._obsProps = undefined;\n this.forceUpdate = undefined;\n this._render = undefined;\n this._disposable = undefined;\n this.contextValues = new Map();\n this.cleanupEffect = () => {\n return () => {\n this._disposable?.dispose();\n };\n };\n this.itemsToRender = [];\n this.handleAfterRender = () => {\n unstable_batchedUpdates(() => {\n for (const change of this.itemsToRender) {\n if (!change.rendered) {\n change.forceUpdate();\n }\n }\n });\n this.itemsToRender = [];\n };\n this.rendering = undefined;\n this.isRendering = false;\n this.rendered = false;\n }\n toString() {\n return this.debugName;\n }\n updateProps(props) {\n if (!this._obsProps) {\n this._obsProps = observableValue(this, props);\n this._render = this.renderFactory(this._obsProps, () => this.contextValues);\n this.rendering = derived(this, this._render);\n this._disposable = batchedUpdater.addDependency(this.rendering, this);\n }\n else {\n this._obsProps.set(props, undefined);\n }\n }\n}\nfunction obsView(componentName, render, contexts) {\n const plusOne = (x) => x + 1;\n const createVM = () => new ViewImpl(componentName + (++viewIdx), render);\n const fn = function (props) {\n const forceUpdate = useReducer(plusOne, 0)[1];\n const state = useState(createVM)[0];\n // Read and update context values each render\n for (const ctx of contexts ?? []) {\n state.contextValues.set(ctx, useContext(ctx)); // eslint-disable-line react-hooks/rules-of-hooks\n }\n useEffect(state.cleanupEffect, []);\n useEffect(state.handleAfterRender);\n if (state.isRendering) {\n throw new Error(\"Component is already rendering\");\n }\n state.isRendering = true;\n renderingCount++;\n try {\n state.forceUpdate = forceUpdate;\n state.updateProps(props);\n const result = state.rendering.get();\n state.rendered = true;\n return result;\n }\n finally {\n state.isRendering = false;\n renderingCount--;\n }\n };\n fn.displayName = componentName;\n return fn;\n}\nconst ObsView = obsView('ObsView', (props) => reader => props.read(reader).children(reader));\n\nexport { ObsView, obsView };\n//# sourceMappingURL=obsView.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { obsView } from './obsView.js';\nimport { mapObject } from './utils.js';\n\n/**\n * Creates a React component with typed observable props.\n * Props are transformed according to their IPropertyTransformerFactory.\n */\nfunction view(props, render) {\n return obsView('view', (p) => {\n const readableProps = mapObject(props, (value, key) => {\n return value.create(reader => p.read(reader)[key], undefined);\n });\n return reader => {\n const propValues = mapObject(readableProps, (value) => {\n return value.read(reader);\n });\n return render(reader, propValues);\n };\n });\n}\n\nexport { view };\n//# sourceMappingURL=view.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { derivedDisposable } from '@vscode/observables';\nimport { obsView } from './obsView.js';\nimport { mapObject } from './utils.js';\nimport { getOrCreateViewModelContext } from './viewModel.js';\n\n/** Collect unique _requiredContext from transformers */\nfunction collectRequiredContexts(propsDesc) {\n const contexts = [];\n for (const t of Object.values(propsDesc)) {\n const ctx = t._requiredContext;\n if (ctx && !contexts.includes(ctx))\n contexts.push(ctx);\n }\n return contexts;\n}\nfunction viewWithModel(viewModelCtor, propsOrRender, maybeRender) {\n const props = typeof propsOrRender === 'function' ? {} : propsOrRender;\n const render = typeof propsOrRender === 'function' ? propsOrRender : maybeRender;\n const modelPropsDesc = '_props' in viewModelCtor ? viewModelCtor._props : {};\n const requiredContexts = collectRequiredContexts({ ...modelPropsDesc, ...props });\n // Always create the context so ProvideViewModel can work\n const viewModelContext = getOrCreateViewModelContext(viewModelCtor);\n const allContexts = [...requiredContexts, viewModelContext];\n return obsView('viewWithModel', (p, getContextValues) => {\n const contextValues = getContextValues();\n const providedModel = contextValues.get(viewModelContext);\n const readableModelProps = '_props' in viewModelCtor\n ? mapObject(viewModelCtor._props, (v, k) => v.create((r) => p.read(r)[k], contextValues.get(v._requiredContext)))\n : {};\n const model = providedModel\n ? { read: () => providedModel, dispose: () => { } }\n : derivedDisposable(reader => {\n const modelProps = mapObject(readableModelProps, (v) => v.read(reader));\n return new viewModelCtor(modelProps);\n });\n const readableProps = mapObject(props, (v, k) => v.create((r) => p.read(r)[k], contextValues.get(v._requiredContext)));\n return (reader) => {\n const m = model.read(reader);\n const propValues = mapObject(readableProps, (v) => v.read(reader));\n return render(reader, m, propValues);\n };\n }, allContexts.length > 0 ? allContexts : undefined);\n}\n\nexport { viewWithModel };\n//# sourceMappingURL=viewWithModel.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { jsx } from 'react/jsx-runtime';\nimport { prop } from './IPropertyTransformer.js';\nimport { view } from './view.js';\n\n/**\n * A component that renders an observable ReactNode value.\n * Re-renders when the observable changes.\n * Usage: <Value value={myObservable} />\n */\nconst Value = view({ value: prop.obs() }, (reader, props) => {\n return props.value.read(reader);\n});\n/**\n * Helper function to render an observable as inline JSX.\n * Usage: {val(myObservable)}\n */\nfunction val(v) {\n return jsx(Value, { value: v });\n}\n\nexport { Value, val };\n//# sourceMappingURL=Value.js.map\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { jsx } from 'react/jsx-runtime';\nimport { createContext, useContext } from 'react';\nimport { derived } from '@vscode/observables';\n\nfunction createServiceKey(nameOrCtor) {\n const name = typeof nameOrCtor === 'string' ? nameOrCtor : nameOrCtor.name;\n return { _brand: undefined, id: Symbol(name), name };\n}\n// =============================================================================\n// DI Container\n// =============================================================================\nclass DIContainer {\n constructor(parent = null) {\n this._services = new Map();\n this._parent = parent;\n }\n register(key, service) {\n this._services.set(key.id, service);\n return this;\n }\n get(key) {\n const service = this._services.get(key.id);\n if (service !== undefined)\n return service;\n if (this._parent)\n return this._parent.get(key);\n throw new Error(`Service \"${key.name}\" not registered`);\n }\n has(key) {\n return this._services.has(key.id) || (this._parent?.has(key) ?? false);\n }\n createChild() {\n return new DIContainer(this);\n }\n}\n// =============================================================================\n// React Context\n// =============================================================================\nconst DIContext = createContext(null);\nfunction DIProvider({ container, children }) {\n return jsx(DIContext.Provider, { value: container, children: children });\n}\nfunction useDIContainer() {\n const container = useContext(DIContext);\n if (!container)\n throw new Error(\"DIProvider not found\");\n return container;\n}\n// =============================================================================\n// inject() - Property Transformer for DI\n// =============================================================================\nclass InjectTransformerFactory {\n constructor(serviceKey) {\n this.serviceKey = serviceKey;\n this._requiredContext = DIContext;\n }\n create(readable, contextValue) {\n const container = contextValue;\n let cachedService;\n return derived(reader => {\n // Check if an explicit value was provided as a prop\n const explicitValue = readable(reader);\n if (explicitValue !== undefined) {\n return explicitValue;\n }\n // Otherwise, use DI container (cached)\n if (cachedService === undefined) {\n if (!container)\n throw new Error(`inject(${this.serviceKey.name}): DIProvider not found`);\n cachedService = container.get(this.serviceKey);\n }\n return cachedService;\n });\n }\n}\n/** Inject a service from DIContainer into a ViewModel property */\nfunction inject(key) {\n return new InjectTransformerFactory(key);\n}\n\nexport { DIContainer, DIContext, DIProvider, createServiceKey, inject, useDIContainer };\n//# sourceMappingURL=di.js.map\n","import type { FixtureNode, ComponentDefinition } from '../core/index.js';\nimport type { FixturePath } from '../core/FixturePath.js';\n\n/**\n * Explorer's tree node structure, derived from FixtureNode.\n * This is the explorer's own representation of the fixture tree.\n */\nexport interface ExplorerTreeNode {\n readonly id: FixturePath;\n readonly name: string;\n readonly type: 'folder' | 'variants' | 'component';\n readonly children?: readonly ExplorerTreeNode[];\n readonly component?: ComponentDefinition;\n readonly labels: readonly string[];\n}\n\n/**\n * Converts a FixtureNode tree to ExplorerTreeNode tree.\n * This allows the explorer to have its own tree structure.\n */\nexport function toExplorerTree(node: FixtureNode): ExplorerTreeNode {\n return {\n id: node.id,\n name: node.name,\n type: node.type,\n children: node.children?.map(toExplorerTree),\n component: node.component,\n labels: node.labels,\n };\n}\n","import type { ExplorerTreeNode } from './types.js';\n\nfunction nodeMatches(node: ExplorerTreeNode, lowerQuery: string): boolean {\n\tif (node.name.toLowerCase().includes(lowerQuery)) return true;\n\tfor (const label of node.labels) {\n\t\tif (label.toLowerCase().includes(lowerQuery)) return true;\n\t}\n\treturn false;\n}\n\nexport function filterTree(root: ExplorerTreeNode, query: string | undefined): ExplorerTreeNode | undefined {\n\tif (!query) return root;\n\tconst lowerQuery = query.toLowerCase();\n\treturn filterNode(root, lowerQuery);\n}\n\nfunction filterNode(node: ExplorerTreeNode, lowerQuery: string): ExplorerTreeNode | undefined {\n\tconst selfMatches = nodeMatches(node, lowerQuery);\n\n\tif (!node.children || node.children.length === 0) {\n\t\treturn selfMatches ? node : undefined;\n\t}\n\n\t// If this node matches, keep the entire subtree\n\tif (selfMatches) return node;\n\n\t// Otherwise, keep only children (recursively) that match\n\tconst filteredChildren: ExplorerTreeNode[] = [];\n\tfor (const child of node.children) {\n\t\tconst filtered = filterNode(child, lowerQuery);\n\t\tif (filtered) filteredChildren.push(filtered);\n\t}\n\n\tif (filteredChildren.length === 0) return undefined;\n\n\treturn {\n\t\t...node,\n\t\tchildren: filteredChildren,\n\t};\n}\n","import { observableValue, type ISettableObservable } from '@vscode/observables';\n\nexport interface LocalStorageObservableOptions<T> {\n readonly storageKey: string;\n readonly defaultValue: T;\n /** Serialize value to string for localStorage. Defaults to JSON.stringify. */\n readonly serialize?: (value: T) => string;\n /** Deserialize string from localStorage. Defaults to JSON.parse. */\n readonly deserialize?: (raw: string) => T;\n}\n\n/**\n * Creates an observable that persists its value to localStorage.\n * The value is loaded from localStorage on creation (if present),\n * and saved to localStorage whenever it changes.\n */\nexport function createLocalStorageObservable<T>(\n owner: object,\n options: LocalStorageObservableOptions<T>\n): ISettableObservable<T> {\n const {\n storageKey,\n defaultValue,\n serialize = JSON.stringify,\n deserialize = JSON.parse,\n } = options;\n\n // Try to load from localStorage\n let initialValue = defaultValue;\n try {\n const stored = localStorage.getItem(storageKey);\n if (stored !== null) {\n initialValue = deserialize(stored);\n }\n } catch {\n // Ignore parse errors, use default\n }\n\n const obs = observableValue<T>(owner, initialValue);\n\n // Wrap the set method to persist to localStorage\n const originalSet = obs.set.bind(obs);\n obs.set = (value: T, tx: undefined) => {\n try {\n localStorage.setItem(storageKey, serialize(value));\n } catch {\n // Ignore storage errors (quota exceeded, etc.)\n }\n originalSet(value, tx);\n };\n\n return obs;\n}\n","import { observableValue, type ISettableObservable } from '@vscode/observables';\n\nexport function createQueryParamObservable(\n owner: object,\n paramName: string,\n): ISettableObservable<string | undefined> {\n const params = new URLSearchParams(location.search);\n const initialValue = params.get(paramName) || undefined;\n\n const obs = observableValue<string | undefined>(owner, initialValue);\n\n window.addEventListener('popstate', () => {\n const p = new URLSearchParams(location.search);\n obs.set(p.get(paramName) || undefined, undefined);\n });\n\n const originalSet = obs.set.bind(obs);\n obs.set = (value: string | undefined, tx: undefined) => {\n const p = new URLSearchParams(location.search);\n if (!value) {\n p.delete(paramName);\n } else {\n p.set(paramName, value);\n }\n const search = p.toString();\n const newUrl = location.pathname + (search ? '?' + search : '') + location.hash;\n history.replaceState(history.state, '', newUrl);\n originalSet(value, tx);\n };\n\n return obs;\n}\n\nexport function buildQueryParamUrl(paramName: string, value: string): string {\n const p = new URLSearchParams(location.search);\n p.set(paramName, value);\n return location.pathname + '?' + p.toString();\n}\n","import { observableValue, type IReader, type ISettableObservable } from '@vscode/observables';\nimport type { PageMode } from '../core/index.js';\nimport { resolveViewport } from '../core/index.js';\n\nexport type PagePreviewMode = 'fit' | 'responsive' | 'actual';\n\nexport interface PageViewportSettings {\n readonly viewportIndex: number;\n readonly width: number;\n readonly height: number;\n readonly mode: PagePreviewMode;\n}\n\ninterface StoredPageViewportSettings {\n readonly viewportIndex?: number;\n readonly width?: number;\n readonly height?: number;\n readonly mode?: PagePreviewMode;\n}\n\nexport interface PagePreviewGeometry {\n readonly logicalWidth: number;\n readonly logicalHeight: number;\n readonly scale: number;\n readonly visualWidth: number;\n readonly visualHeight: number;\n}\n\nconst STORAGE_KEY = 'component-explorer:pageViewports';\nconst MIN_VIEWPORT_SIZE = 1;\nconst MAX_VIEWPORT_SIZE = 10_000;\n\nfunction clampDimension(value: number | undefined, fallback: number): number {\n if (value === undefined || !Number.isFinite(value)) {\n return fallback;\n }\n return Math.min(MAX_VIEWPORT_SIZE, Math.max(MIN_VIEWPORT_SIZE, Math.round(value)));\n}\n\nfunction clampViewportIndex(value: number | undefined, pageMode: PageMode): number {\n if (value === undefined || !Number.isInteger(value)) {\n return 0;\n }\n return Math.min(Math.max(value, 0), Math.max(0, pageMode.viewports.length - 1));\n}\n\nfunction isPagePreviewMode(value: unknown): value is PagePreviewMode {\n return value === 'fit' || value === 'responsive' || value === 'actual';\n}\n\nfunction defaultViewport(pageMode: PageMode, viewportIndex: number): { width: number; height: number } {\n const preset = pageMode.viewports[viewportIndex] ?? 'desktop';\n return resolveViewport(preset);\n}\n\nfunction resolveSettings(\n stored: StoredPageViewportSettings | undefined,\n pageMode: PageMode,\n): PageViewportSettings {\n const viewportIndex = clampViewportIndex(stored?.viewportIndex, pageMode);\n const fallback = defaultViewport(pageMode, viewportIndex);\n return {\n viewportIndex,\n width: clampDimension(stored?.width, fallback.width),\n height: clampDimension(stored?.height, fallback.height),\n mode: isPagePreviewMode(stored?.mode) ? stored.mode : 'fit',\n };\n}\n\nexport function calculatePagePreviewGeometry(\n settings: PageViewportSettings,\n availableWidth: number,\n availableHeight = 0,\n): PagePreviewGeometry {\n const usableWidth = Number.isFinite(availableWidth)\n ? Math.max(0, Math.floor(availableWidth))\n : 0;\n const usableHeight = Number.isFinite(availableHeight)\n ? Math.max(0, Math.floor(availableHeight))\n : 0;\n const logicalWidth = settings.mode === 'responsive' && usableWidth > 0\n ? usableWidth\n : settings.width;\n const logicalHeight = settings.mode === 'responsive' && usableHeight > 0\n ? usableHeight\n : settings.height;\n const scale = settings.mode === 'fit' && usableWidth > 0\n ? Math.min(1, usableWidth / logicalWidth)\n : 1;\n\n return {\n logicalWidth,\n logicalHeight,\n scale,\n visualWidth: logicalWidth * scale,\n visualHeight: logicalHeight * scale,\n };\n}\n\nexport class FixtureViewportStore {\n private readonly _values: ISettableObservable<Record<string, StoredPageViewportSettings>>;\n\n constructor() {\n this._values = observableValue('fixturePageViewports', this._load());\n }\n\n read(reader: IReader, fixtureId: string, pageMode: PageMode): PageViewportSettings {\n return resolveSettings(this._values.read(reader)[fixtureId], pageMode);\n }\n\n get(fixtureId: string, pageMode: PageMode): PageViewportSettings {\n return resolveSettings(this._values.get()[fixtureId], pageMode);\n }\n\n selectViewport(fixtureId: string, pageMode: PageMode, viewportIndex: number): void {\n const index = clampViewportIndex(viewportIndex, pageMode);\n const viewport = defaultViewport(pageMode, index);\n const current = this.get(fixtureId, pageMode);\n this._set(fixtureId, {\n viewportIndex: index,\n width: viewport.width,\n height: viewport.height,\n mode: current.mode,\n });\n }\n\n setWidth(fixtureId: string, pageMode: PageMode, width: number): void {\n const current = this.get(fixtureId, pageMode);\n this._set(fixtureId, { ...current, width: clampDimension(width, current.width) });\n }\n\n setHeight(fixtureId: string, pageMode: PageMode, height: number): void {\n const current = this.get(fixtureId, pageMode);\n this._set(fixtureId, { ...current, height: clampDimension(height, current.height) });\n }\n\n setMode(fixtureId: string, pageMode: PageMode, mode: PagePreviewMode): void {\n const current = this.get(fixtureId, pageMode);\n this._set(fixtureId, { ...current, mode });\n }\n\n private _set(fixtureId: string, settings: StoredPageViewportSettings): void {\n const next = { ...this._values.get(), [fixtureId]: settings };\n this._values.set(next, undefined);\n this._persist(next);\n }\n\n private _load(): Record<string, StoredPageViewportSettings> {\n try {\n const raw = localStorage.getItem(STORAGE_KEY);\n if (!raw) {\n return {};\n }\n const parsed: unknown = JSON.parse(raw);\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n return parsed as Record<string, StoredPageViewportSettings>;\n }\n } catch {\n // Ignore malformed or inaccessible persisted UI state.\n }\n return {};\n }\n\n private _persist(value: Record<string, StoredPageViewportSettings>): void {\n try {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(value));\n } catch {\n // Ignore storage failures; viewport controls remain usable for this session.\n }\n }\n}\n","import { observableValue, type IReader } from '@vscode/observables';\nimport type { ComponentRendering } from '../core/ComponentRenderer.js';\nimport type { FixtureItem } from './ExplorerModel.js';\n\nexport interface FixtureDebugInfo {\n readonly fixture: FixtureItem;\n readonly rendering: ComponentRendering;\n readonly ready: boolean;\n readonly hasOutput: boolean;\n readonly outputEditable: boolean;\n}\n\nexport class FixtureDebugStore {\n private readonly _entries = observableValue<ReadonlyMap<string, FixtureDebugInfo>>(\n this,\n new Map(),\n );\n\n read(reader: IReader, fixtureId: string): FixtureDebugInfo | undefined {\n return this._entries.read(reader).get(fixtureId);\n }\n\n get(fixtureId: string): FixtureDebugInfo | undefined {\n return this._entries.get().get(fixtureId);\n }\n\n setRendering(fixture: FixtureItem, rendering: ComponentRendering): void {\n this._set(fixture.id, {\n fixture,\n rendering,\n ready: false,\n hasOutput: false,\n outputEditable: false,\n });\n }\n\n markReady(fixture: FixtureItem, rendering: ComponentRendering): void {\n if (this._entries.get().get(fixture.id)?.rendering !== rendering) return;\n this._set(fixture.id, {\n fixture,\n rendering,\n ready: true,\n hasOutput: rendering.hasOutput,\n outputEditable: rendering.outputEditable,\n });\n }\n\n remove(fixtureId: string, rendering: ComponentRendering): void {\n const current = this._entries.get();\n if (current.get(fixtureId)?.rendering !== rendering) return;\n const next = new Map(current);\n next.delete(fixtureId);\n this._entries.set(next, undefined);\n }\n\n private _set(fixtureId: string, info: FixtureDebugInfo): void {\n const next = new Map(this._entries.get());\n next.set(fixtureId, info);\n this._entries.set(next, undefined);\n }\n}\n","export type DebugSplitOrientation = 'horizontal' | 'vertical';\nexport type DebugDockZone = 'center' | 'left' | 'right' | 'top' | 'bottom';\n\nexport interface DebugStackNode {\n readonly type: 'stack';\n readonly id: string;\n readonly entryKeys: readonly string[];\n readonly activeEntryKey: string;\n}\n\nexport interface DebugSplitNode {\n readonly type: 'split';\n readonly id: string;\n readonly orientation: DebugSplitOrientation;\n readonly ratio: number;\n readonly first: DebugWorkbenchNode;\n readonly second: DebugWorkbenchNode;\n}\n\nexport type DebugWorkbenchNode = DebugStackNode | DebugSplitNode;\n\nlet nextNodeId = 0;\n\nexport function createDebugWorkbenchLayout(\n entryKeys: readonly string[],\n activeEntryKey: string | undefined,\n): DebugWorkbenchNode {\n if (entryKeys.length === 0) {\n throw new Error('A debug workbench requires at least one entry');\n }\n return createStack(entryKeys, activeEntryKey);\n}\n\nexport function getDebugWorkbenchEntryOrder(node: DebugWorkbenchNode): readonly string[] {\n return node.type === 'stack'\n ? node.entryKeys\n : [...getDebugWorkbenchEntryOrder(node.first), ...getDebugWorkbenchEntryOrder(node.second)];\n}\n\nexport function getVisibleDebugEntryKeys(node: DebugWorkbenchNode): ReadonlySet<string> {\n const result = new Set<string>();\n visitStacks(node, stack => result.add(stack.activeEntryKey));\n return result;\n}\n\nexport function getFirstDebugStackId(node: DebugWorkbenchNode): string {\n return node.type === 'stack' ? node.id : getFirstDebugStackId(node.first);\n}\n\nexport function reconcileDebugWorkbenchLayout(\n node: DebugWorkbenchNode,\n entryKeys: readonly string[],\n activeEntryKey: string | undefined,\n): DebugWorkbenchNode {\n if (entryKeys.length === 0) {\n throw new Error('A debug workbench requires at least one entry');\n }\n\n const allowedKeys = new Set(entryKeys);\n let result = pruneEntries(node, allowedKeys);\n if (!result) {\n return createDebugWorkbenchLayout(entryKeys, activeEntryKey);\n }\n\n const presentKeys = new Set(getDebugWorkbenchEntryOrder(result));\n const missingKeys = entryKeys.filter(key => !presentKeys.has(key));\n if (missingKeys.length > 0) {\n const firstStackId = getFirstDebugStackId(result);\n const firstStack = findStack(result, firstStackId);\n if (!firstStack) {\n throw new Error(`Debug stack \"${firstStackId}\" is missing`);\n }\n result = replaceStack(result, firstStackId, {\n ...firstStack,\n entryKeys: [...firstStack.entryKeys, ...missingKeys],\n });\n }\n\n return activeEntryKey && allowedKeys.has(activeEntryKey)\n ? activateDebugEntry(result, activeEntryKey)\n : result;\n}\n\nexport function activateDebugEntry(\n node: DebugWorkbenchNode,\n entryKey: string,\n): DebugWorkbenchNode {\n return mapStacks(node, stack => stack.entryKeys.includes(entryKey)\n ? stack.activeEntryKey === entryKey\n ? stack\n : { ...stack, activeEntryKey: entryKey }\n : stack);\n}\n\nexport function reorderDebugEntry(\n node: DebugWorkbenchNode,\n entryKey: string,\n targetEntryKey: string,\n before: boolean,\n): DebugWorkbenchNode {\n if (entryKey === targetEntryKey) return node;\n const targetStack = findStackContaining(node, targetEntryKey);\n if (!targetStack) return node;\n const withoutEntry = removeEntry(node, entryKey);\n if (!withoutEntry) return node;\n const currentTargetStack = findStack(withoutEntry, targetStack.id);\n if (!currentTargetStack) return node;\n const targetIndex = currentTargetStack.entryKeys.indexOf(targetEntryKey);\n const index = targetIndex + (before ? 0 : 1);\n return replaceStack(withoutEntry, currentTargetStack.id, {\n ...currentTargetStack,\n entryKeys: insertAt(currentTargetStack.entryKeys, index, entryKey),\n activeEntryKey: entryKey,\n });\n}\n\nexport function dockDebugEntry(\n node: DebugWorkbenchNode,\n entryKey: string,\n targetStackId: string,\n zone: DebugDockZone,\n): DebugWorkbenchNode {\n const sourceStack = findStackContaining(node, entryKey);\n const targetStack = findStack(node, targetStackId);\n if (!sourceStack || !targetStack) return node;\n\n if (zone === 'center') {\n if (sourceStack.id === targetStack.id) {\n return activateDebugEntry(node, entryKey);\n }\n const withoutEntry = removeEntry(node, entryKey);\n if (!withoutEntry) return node;\n const currentTarget = findStack(withoutEntry, targetStackId);\n if (!currentTarget) return node;\n return replaceStack(withoutEntry, targetStackId, {\n ...currentTarget,\n entryKeys: [...currentTarget.entryKeys, entryKey],\n activeEntryKey: entryKey,\n });\n }\n\n if (sourceStack.id === targetStack.id && sourceStack.entryKeys.length === 1) {\n return node;\n }\n const withoutEntry = removeEntry(node, entryKey);\n if (!withoutEntry) return node;\n const currentTarget = findStack(withoutEntry, targetStackId);\n if (!currentTarget) return node;\n\n const newStack = createStack([entryKey], entryKey);\n const horizontal = zone === 'left' || zone === 'right';\n const before = zone === 'left' || zone === 'top';\n const split: DebugSplitNode = {\n type: 'split',\n id: createNodeId('split'),\n orientation: horizontal ? 'horizontal' : 'vertical',\n ratio: 0.5,\n first: before ? newStack : currentTarget,\n second: before ? currentTarget : newStack,\n };\n return replaceNode(withoutEntry, targetStackId, split);\n}\n\nexport function updateDebugSplitRatio(\n node: DebugWorkbenchNode,\n splitId: string,\n ratio: number,\n): DebugWorkbenchNode {\n if (node.type === 'stack') return node;\n if (node.id === splitId) {\n return { ...node, ratio: clampRatio(ratio) };\n }\n const first = updateDebugSplitRatio(node.first, splitId, ratio);\n const second = updateDebugSplitRatio(node.second, splitId, ratio);\n return first === node.first && second === node.second ? node : { ...node, first, second };\n}\n\nfunction createStack(\n entryKeys: readonly string[],\n activeEntryKey: string | undefined,\n): DebugStackNode {\n return {\n type: 'stack',\n id: createNodeId('stack'),\n entryKeys: [...entryKeys],\n activeEntryKey: activeEntryKey && entryKeys.includes(activeEntryKey)\n ? activeEntryKey\n : entryKeys[0],\n };\n}\n\nfunction createNodeId(prefix: string): string {\n return `${prefix}-${nextNodeId++}`;\n}\n\nfunction mapStacks(\n node: DebugWorkbenchNode,\n mapper: (stack: DebugStackNode) => DebugStackNode,\n): DebugWorkbenchNode {\n if (node.type === 'stack') return mapper(node);\n const first = mapStacks(node.first, mapper);\n const second = mapStacks(node.second, mapper);\n return first === node.first && second === node.second ? node : { ...node, first, second };\n}\n\nfunction visitStacks(node: DebugWorkbenchNode, visitor: (stack: DebugStackNode) => void): void {\n if (node.type === 'stack') {\n visitor(node);\n return;\n }\n visitStacks(node.first, visitor);\n visitStacks(node.second, visitor);\n}\n\nfunction findStackContaining(node: DebugWorkbenchNode, entryKey: string): DebugStackNode | undefined {\n if (node.type === 'stack') return node.entryKeys.includes(entryKey) ? node : undefined;\n return findStackContaining(node.first, entryKey) ?? findStackContaining(node.second, entryKey);\n}\n\nfunction findStack(node: DebugWorkbenchNode, stackId: string): DebugStackNode | undefined {\n if (node.type === 'stack') return node.id === stackId ? node : undefined;\n return findStack(node.first, stackId) ?? findStack(node.second, stackId);\n}\n\nfunction removeEntry(node: DebugWorkbenchNode, entryKey: string): DebugWorkbenchNode | undefined {\n if (node.type === 'stack') {\n if (!node.entryKeys.includes(entryKey)) return node;\n const entryKeys = node.entryKeys.filter(key => key !== entryKey);\n if (entryKeys.length === 0) return undefined;\n return {\n ...node,\n entryKeys,\n activeEntryKey: node.activeEntryKey === entryKey ? entryKeys[0] : node.activeEntryKey,\n };\n }\n const first = removeEntry(node.first, entryKey);\n const second = removeEntry(node.second, entryKey);\n if (!first) return second;\n if (!second) return first;\n return first === node.first && second === node.second ? node : { ...node, first, second };\n}\n\nfunction pruneEntries(\n node: DebugWorkbenchNode,\n allowedKeys: ReadonlySet<string>,\n): DebugWorkbenchNode | undefined {\n if (node.type === 'stack') {\n const entryKeys = node.entryKeys.filter(key => allowedKeys.has(key));\n if (entryKeys.length === 0) return undefined;\n const activeEntryKey = entryKeys.includes(node.activeEntryKey)\n ? node.activeEntryKey\n : entryKeys[0];\n if (entryKeys.length === node.entryKeys.length && activeEntryKey === node.activeEntryKey) {\n return node;\n }\n return {\n ...node,\n entryKeys,\n activeEntryKey,\n };\n }\n\n const first = pruneEntries(node.first, allowedKeys);\n const second = pruneEntries(node.second, allowedKeys);\n if (!first) return second;\n if (!second) return first;\n return first === node.first && second === node.second ? node : { ...node, first, second };\n}\n\nfunction replaceStack(\n node: DebugWorkbenchNode,\n stackId: string,\n replacement: DebugStackNode,\n): DebugWorkbenchNode {\n return replaceNode(node, stackId, replacement);\n}\n\nfunction replaceNode(\n node: DebugWorkbenchNode,\n nodeId: string,\n replacement: DebugWorkbenchNode,\n): DebugWorkbenchNode {\n if (node.id === nodeId) return replacement;\n if (node.type === 'stack') return node;\n const first = replaceNode(node.first, nodeId, replacement);\n const second = replaceNode(node.second, nodeId, replacement);\n return first === node.first && second === node.second ? node : { ...node, first, second };\n}\n\nfunction insertAt(values: readonly string[], index: number, value: string): readonly string[] {\n return [...values.slice(0, index), value, ...values.slice(index)];\n}\n\nfunction clampRatio(ratio: number): number {\n return Math.max(0.2, Math.min(0.8, ratio));\n}\n","import { observableValue, type ISettableObservable } from '@vscode/observables';\nimport {\n createDebugWorkbenchLayout,\n reconcileDebugWorkbenchLayout,\n type DebugWorkbenchNode,\n} from './DebugWorkbenchLayout.js';\n\nexport class DebugWorkbenchStateStore {\n private readonly layouts = new Map<string, ISettableObservable<DebugWorkbenchNode>>();\n private readonly activeEntries = new Map<string, ISettableObservable<string | undefined>>();\n\n getLayout(\n workbenchId: string,\n entryKeys: readonly string[],\n activeEntryKey: string | undefined,\n ): ISettableObservable<DebugWorkbenchNode> {\n let layout = this.layouts.get(workbenchId);\n if (!layout) {\n layout = observableValue(\n this,\n createDebugWorkbenchLayout(entryKeys, activeEntryKey),\n );\n this.layouts.set(workbenchId, layout);\n return layout;\n }\n\n const current = layout.get();\n const next = reconcileDebugWorkbenchLayout(current, entryKeys, activeEntryKey);\n if (next !== current) layout.set(next, undefined);\n return layout;\n }\n\n getActiveEntry(workbenchId: string): ISettableObservable<string | undefined> {\n let activeEntry = this.activeEntries.get(workbenchId);\n if (!activeEntry) {\n activeEntry = observableValue<string | undefined>(this, undefined);\n this.activeEntries.set(workbenchId, activeEntry);\n }\n return activeEntry;\n }\n}\n","import { observableValue, derived, IReader } from '@vscode/observables';\nimport { ViewModel, prop } from '@vscode/observables-react';\nimport type { FixtureRegistry, ComponentDefinition } from '../core/index.js';\nimport { FixtureInputStore } from '../core/index.js';\nimport { FixturePath } from '../core/FixturePath.js';\nimport { type ExplorerTreeNode, toExplorerTree } from './types.js';\nimport { filterTree } from './treeFilter.js';\nimport { createLocalStorageObservable } from '../lib/localStorageObservable.js';\nimport { createQueryParamObservable } from '../lib/queryParamObservable.js';\nimport type { DaemonModel } from '../daemon/index.js';\nimport type { ReportModel } from '../report/ReportModel.js';\nimport type { ReportFixtureItem } from './ReportComparisonRow.js';\nimport { FixtureViewportStore } from './PageViewportState.js';\nimport { FixtureDebugStore } from './FixtureDebugStore.js';\nimport { DebugWorkbenchStateStore } from './DebugWorkbenchState.js';\n\nexport type ViewMode = 'session' | 'diff' | 'report';\n\n/**\n * A fixture item to be rendered in the preview area.\n */\nexport interface FixtureItem {\n readonly id: string;\n readonly name: string;\n readonly path: string;\n readonly component: ComponentDefinition;\n}\n\n/**\n * A screenshot comparison item for diff mode.\n */\nexport interface ScreenshotComparisonItem {\n readonly fixtureId: string;\n readonly name: string;\n readonly path: string;\n}\n\n/**\n * A preview row can be a live fixture, a variant group, or a screenshot comparison.\n */\nexport type PreviewRow =\n | { readonly type: 'single'; readonly fixture: FixtureItem }\n | { readonly type: 'variants'; readonly id: string; readonly name: string; readonly path: string; readonly fixtures: readonly FixtureItem[] }\n | { readonly type: 'screenshot-comparison'; readonly id: string; readonly name: string; readonly path: string; readonly items: readonly ScreenshotComparisonItem[] }\n | { readonly type: 'report-comparison'; readonly id: string; readonly name: string; readonly path: string; readonly items: readonly ReportFixtureItem[] };\n\nexport class ExplorerModel extends ViewModel({\n registry: prop.const<FixtureRegistry>(),\n daemonModel: prop.const<DaemonModel | undefined>(),\n reportModel: prop.const<ReportModel | undefined>(),\n}) {\n readonly leftSidebarVisible = createLocalStorageObservable<boolean>(this, {\n storageKey: 'component-explorer:leftSidebarVisible',\n defaultValue: true,\n });\n readonly rightSidebarVisible = createLocalStorageObservable<boolean>(this, {\n storageKey: 'component-explorer:rightSidebarVisible',\n defaultValue: false,\n });\n readonly isDarkTheme = createLocalStorageObservable<boolean>(this, {\n storageKey: 'component-explorer:isDarkTheme',\n defaultValue: true,\n });\n readonly selectedNodeId = createQueryParamObservable(this, 'fixture');\n readonly expandedNodeIds = observableValue<ReadonlySet<string>>(this, this._initialExpandedNodes());\n\n readonly viewMode = createLocalStorageObservable<ViewMode>(this, {\n storageKey: 'component-explorer:viewMode',\n defaultValue: 'session',\n });\n\n get daemonAvailable(): boolean { return this.props.daemonModel !== undefined; }\n get daemon(): DaemonModel | undefined { return this.props.daemonModel; }\n get reportModel(): ReportModel | undefined { return this.props.reportModel; }\n get isReportMode(): boolean { return this.props.reportModel !== undefined; }\n\n readonly loading = derived(this, (reader) => this.props.registry.loading.read(reader));\n readonly error = derived(this, (reader) => this.props.registry.error.read(reader));\n\n readonly searchQuery = createQueryParamObservable(this, 'search');\n\n /** The explorer's tree derived from the registry or report */\n readonly tree = derived(this, (reader) => {\n const report = this.props.reportModel;\n if (report) {\n return report.buildTree(reader);\n }\n const root = this.props.registry.root.read(reader);\n return toExplorerTree(root);\n });\n\n readonly filteredTree = derived(this, (reader) => {\n const tree = this.tree.read(reader);\n const query = this.searchQuery.read(reader);\n return filterTree(tree, query) ?? { ...tree, children: [] };\n });\n\n readonly selectedNode = derived(this, (reader) => {\n const nodeId = this.selectedNodeId.read(reader);\n if (nodeId === undefined) return undefined;\n const tree = this.filteredTree.read(reader);\n if (tree.id.value === nodeId) return tree;\n return this._findNode(tree.children ?? [], nodeId);\n });\n\n /** List of preview rows to render based on current selection and view mode */\n readonly selectedFixtures = derived(this, (reader): readonly PreviewRow[] => {\n const selectedNode = this.selectedNode.read(reader);\n if (!selectedNode) return [];\n\n const pathPrefix = selectedNode.type === 'component'\n ? selectedNode.id.segments.slice(-3).join(' / ')\n : selectedNode.name;\n\n if (this.isReportMode) {\n const report = this.props.reportModel!;\n report.state.read(reader);\n return this._collectReportRows(selectedNode, pathPrefix);\n }\n\n const mode = this.viewMode.read(reader);\n if (mode === 'diff' && this.daemonAvailable) {\n const sessions = this.daemon!.sessions.read(reader);\n if (sessions.length > 1) {\n return this._collectDiffRows(selectedNode, pathPrefix);\n }\n }\n\n return this._collectPreviewRows(selectedNode, pathPrefix);\n });\n\n /** Shared store of per-fixture `input` overrides, edited via the properties panel. */\n readonly inputStore = new FixtureInputStore();\n /** Explorer-only page viewport size and presentation overrides. */\n readonly viewportStore = new FixtureViewportStore();\n /** Live rendered fixture instances used by visibility-scoped debug panels. */\n readonly debugStore = new FixtureDebugStore();\n /** Docking layouts and open-panel selections that survive preview-row recycling. */\n readonly debugWorkbenchState = new DebugWorkbenchStateStore();\n\n /** Flattened list of the live fixtures currently shown in the preview area. */\n readonly renderedFixtures = derived(this, (reader): readonly FixtureItem[] => {\n const rows = this.selectedFixtures.read(reader);\n const fixtures: FixtureItem[] = [];\n for (const row of rows) {\n if (row.type === 'single') {\n fixtures.push(row.fixture);\n } else if (row.type === 'variants') {\n fixtures.push(...row.fixtures);\n }\n }\n return fixtures;\n });\n\n setViewMode = (mode: ViewMode): void => {\n this.viewMode.set(mode, undefined);\n };\n\n navigateToSession = (sessionName: string): void => {\n const daemon = this.props.daemonModel;\n if (!daemon) return;\n const url = daemon.getSessionExplorerUrl(sessionName);\n if (url) {\n window.location.href = url;\n }\n };\n\n toggleLeftSidebar = (): void => {\n this.leftSidebarVisible.set(!this.leftSidebarVisible.get(), undefined);\n };\n\n toggleRightSidebar = (): void => {\n this.rightSidebarVisible.set(!this.rightSidebarVisible.get(), undefined);\n };\n\n toggleTheme = (): void => {\n this.isDarkTheme.set(!this.isDarkTheme.get(), undefined);\n };\n\n selectNode = (nodeId: string): void => {\n this.selectedNodeId.set(nodeId, undefined);\n };\n\n toggleNodeExpanded = (nodeId: string): void => {\n const current = this.expandedNodeIds.get();\n const newSet = new Set(current);\n if (newSet.has(nodeId)) {\n newSet.delete(nodeId);\n } else {\n newSet.add(nodeId);\n }\n this.expandedNodeIds.set(newSet, undefined);\n };\n\n isNodeExpanded(nodeId: string, reader: IReader): boolean {\n if (this.searchQuery.read(reader)) return true;\n return this.expandedNodeIds.read(reader).has(nodeId);\n }\n\n private _initialExpandedNodes(): ReadonlySet<string> {\n const selected = this.selectedNodeId.get();\n if (!selected) return new Set(['']);\n const parts = new FixturePath(selected).segments;\n const expanded = new Set(['']);\n for (let i = 1; i <= parts.length; i++) {\n expanded.add(parts.slice(0, i).join('/'));\n }\n return expanded;\n }\n\n private _findNode(nodes: readonly ExplorerTreeNode[], id: string): ExplorerTreeNode | undefined {\n for (const node of nodes) {\n if (node.id.value === id) return node;\n if (node.children) {\n const found = this._findNode(node.children, id);\n if (found) return found;\n }\n }\n return undefined;\n }\n\n private _collectPreviewRows(node: ExplorerTreeNode, pathPrefix: string): PreviewRow[] {\n if (node.type === 'component' && node.component) {\n return [{\n type: 'single',\n fixture: {\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n component: node.component,\n },\n }];\n }\n\n if (node.type === 'variants') {\n const fixtures: FixtureItem[] = [];\n for (const child of node.children ?? []) {\n if (child.type === 'component' && child.component) {\n fixtures.push({\n id: child.id.value,\n name: child.name,\n path: `${pathPrefix} / ${child.name}`,\n component: child.component,\n });\n }\n }\n if (fixtures.length > 0) {\n return [{\n type: 'variants',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n fixtures,\n }];\n }\n return [];\n }\n\n // Folder: recurse into children\n const result: PreviewRow[] = [];\n for (const child of node.children ?? []) {\n const childPath = pathPrefix ? `${pathPrefix} / ${child.name}` : child.name;\n result.push(...this._collectPreviewRows(child, childPath));\n }\n return result;\n }\n\n /**\n * In diff mode: fixtures become screenshot comparison items showing current vs baseline.\n * Variants become comparison groups.\n */\n private _collectDiffRows(node: ExplorerTreeNode, pathPrefix: string): PreviewRow[] {\n if (node.type === 'component') {\n return [{\n type: 'screenshot-comparison',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n items: [{\n fixtureId: node.id.value,\n name: node.name,\n path: pathPrefix,\n }],\n }];\n }\n\n if (node.type === 'variants') {\n const items: ScreenshotComparisonItem[] = [];\n for (const child of node.children ?? []) {\n if (child.type === 'component') {\n items.push({\n fixtureId: child.id.value,\n name: child.name,\n path: `${pathPrefix} / ${child.name}`,\n });\n }\n }\n if (items.length > 0) {\n return [{\n type: 'screenshot-comparison',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n items,\n }];\n }\n return [];\n }\n\n const result: PreviewRow[] = [];\n for (const child of node.children ?? []) {\n const childPath = pathPrefix ? `${pathPrefix} / ${child.name}` : child.name;\n result.push(...this._collectDiffRows(child, childPath));\n }\n return result;\n }\n\n private _collectReportRows(node: ExplorerTreeNode, pathPrefix: string): PreviewRow[] {\n const reportState = this.props.reportModel!.state.get();\n if (reportState.status !== 'ready') return [];\n const fixtures = reportState.report.fixtures;\n\n if (node.type === 'component') {\n const entry = fixtures[node.id.value];\n if (!entry) return [];\n return [{\n type: 'report-comparison',\n id: node.id.value,\n name: node.name,\n path: pathPrefix,\n items: [{\n fixtureId: node.id.value,\n name: node.name,\n path: pathPrefix,\n entry,\n }],\n }];\n }\n\n const result: PreviewRow[] = [];\n for (const child of node.children ?? []) {\n const childPath = pathPrefix ? `${pathPrefix} / ${child.name}` : child.name;\n result.push(...this._collectReportRows(child, childPath));\n }\n return result;\n }\n}\n","import * as React from 'react';\n\nexport const styles = {\n container: {\n display: 'flex',\n flexDirection: 'row' as const,\n height: '100%',\n width: '100%',\n fontFamily: 'var(--component-explorer-font-family)',\n fontSize: 'var(--component-explorer-font-size)',\n color: 'var(--component-explorer-foreground)',\n backgroundColor: 'var(--component-explorer-editor-background)',\n },\n centerArea: {\n display: 'flex',\n flexDirection: 'column' as const,\n flex: 1,\n overflow: 'hidden',\n },\n titleBar: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n height: '35px',\n minHeight: '35px',\n padding: '0 10px',\n backgroundColor: 'var(--component-explorer-titleBar-activeBackground)',\n color: 'var(--component-explorer-titleBar-activeForeground)',\n borderBottom: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n titleBarSection: {\n display: 'flex',\n alignItems: 'center',\n gap: '2px',\n },\n titleBarCenter: {\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n fontSize: '13px',\n fontWeight: 400,\n },\n titleBarButton: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '28px',\n height: '28px',\n border: 'none',\n background: 'transparent',\n color: 'var(--component-explorer-titleBar-activeForeground)',\n cursor: 'pointer',\n borderRadius: '4px',\n },\n titleBarButtonHover: {\n backgroundColor: 'var(--component-explorer-toolbar-hoverBackground)',\n },\n titleBarButtonActive: {\n backgroundColor: 'var(--component-explorer-toolbar-activeBackground)',\n color: 'var(--component-explorer-focusBorder)',\n },\n sidebar: {\n display: 'flex',\n flexDirection: 'column' as const,\n width: '260px',\n minWidth: '200px',\n backgroundColor: 'var(--component-explorer-sideBar-background)',\n borderRight: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n sidebarRight: {\n borderRight: 'none',\n borderLeft: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n sidebarHeader: {\n display: 'flex',\n alignItems: 'center',\n height: '35px',\n minHeight: '35px',\n padding: '0 12px',\n fontSize: '11px',\n fontWeight: 700,\n textTransform: 'uppercase' as const,\n letterSpacing: '0.04em',\n color: 'var(--component-explorer-titleBar-activeForeground)',\n backgroundColor: 'var(--component-explorer-titleBar-activeBackground)',\n borderBottom: '1px solid var(--component-explorer-titleBar-border, var(--component-explorer-panel-border))',\n },\n sidebarContent: {\n flex: 1,\n overflow: 'auto',\n padding: '4px 0',\n },\n treeItem: {\n display: 'flex',\n alignItems: 'center',\n height: '22px',\n paddingRight: '8px',\n cursor: 'pointer',\n userSelect: 'none' as const,\n },\n treeItemSelected: {\n backgroundColor: 'var(--component-explorer-list-activeSelectionBackground)',\n color: 'var(--component-explorer-list-activeSelectionForeground)',\n },\n treeItemHover: {\n backgroundColor: 'var(--component-explorer-list-hoverBackground)',\n },\n treeItemChevron: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '16px',\n height: '16px',\n color: 'var(--component-explorer-foreground)',\n opacity: 0.8,\n cursor: 'pointer',\n },\n treeItemChevronPlaceholder: {\n width: '16px',\n },\n treeItemIcon: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '16px',\n height: '16px',\n marginRight: '4px',\n },\n treeItemLabel: {\n flex: 1,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap' as const,\n fontSize: '13px',\n },\n treeItemCount: {\n marginLeft: '8px',\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n },\n mainContent: {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: 'var(--component-explorer-editor-background)',\n color: 'var(--component-explorer-descriptionForeground)',\n fontSize: '14px',\n },\n propertiesPanel: {\n padding: '12px',\n },\n propertyRow: {\n marginBottom: '12px',\n },\n propertyLabel: {\n fontSize: '12px',\n color: 'var(--component-explorer-foreground)',\n marginBottom: '4px',\n },\n propertyDescription: {\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n marginTop: '2px',\n },\n propertyInput: {\n width: '100%',\n height: '26px',\n padding: '0 8px',\n fontSize: '13px',\n color: 'var(--component-explorer-input-foreground)',\n backgroundColor: 'var(--component-explorer-input-background)',\n border: '1px solid var(--component-explorer-input-border, transparent)',\n borderRadius: '2px',\n outline: 'none',\n boxSizing: 'border-box' as const,\n },\n propertySelect: {\n width: '100%',\n height: '26px',\n padding: '0 8px',\n fontSize: '13px',\n color: 'var(--component-explorer-dropdown-foreground)',\n backgroundColor: 'var(--component-explorer-dropdown-background)',\n border: '1px solid var(--component-explorer-dropdown-border)',\n borderRadius: '2px',\n outline: 'none',\n boxSizing: 'border-box' as const,\n cursor: 'pointer',\n },\n} as const;\n\n// Helper to merge styles\nexport function mergeStyles(...styleObjects: (React.CSSProperties | undefined | false)[]): React.CSSProperties {\n return Object.assign({}, ...styleObjects.filter(Boolean));\n}\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { styles, mergeStyles } from './styles.js';\n\nclass TitleBarButtonModel extends ViewModel({\n active: prop<boolean>(),\n}) {\n readonly isHovered = observableValue<boolean>(this, false);\n\n get active() { return this.props.active; }\n\n setHovered = (hovered: boolean): void => {\n this.isHovered.set(hovered, undefined);\n };\n}\n\nexport const TitleBarButton = viewWithModel(\n TitleBarButtonModel,\n {\n onClick: prop.const<() => void>(),\n title: prop.const<string>(),\n children: prop.const<React.ReactNode>(),\n },\n (reader, model, props) => {\n const isHovered = model.isHovered.read(reader);\n const active = model.active.read(reader);\n\n const buttonStyle = mergeStyles(\n styles.titleBarButton,\n isHovered && !active && styles.titleBarButtonHover,\n active && styles.titleBarButtonActive,\n );\n\n return (\n <button\n style={buttonStyle}\n onClick={props.onClick}\n title={props.title}\n onMouseEnter={() => model.setHovered(true)}\n onMouseLeave={() => model.setHovered(false)}\n >\n {props.children}\n </button>\n );\n }\n);\n","import * as React from 'react';\n\nexport const ChevronRightIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M5.7 13.7L5 13l4.6-4.6L5 3.7l.7-.7 5.3 5.4-5.3 5.3z\" />\n </svg>\n);\n\nexport const ChevronDownIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M11 5.5L6 10.5L5.3 9.8L9.6 5.5L5.3 1.2L6 0.5L11 5.5z\" transform=\"rotate(90 8 5.5)\" />\n </svg>\n);\n\nexport const ComponentIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M14.5 2H9l-.35.15-.65.64-.65-.64L7 2H1.5l-.5.5v10l.5.5H7l.35-.15.65-.64.65.64.35.15h5.5l.5-.5v-10l-.5-.5zm-7 10H2V3h5v.86L5.85 5l1.15 1.14V10l-1.15-1.14L7 7.72V12zm6 0H8V7.72l1.15 1.14L8 10V6.14L9.15 5 8 3.86V3h5v9z\" />\n </svg>\n);\n\nexport const FolderIcon = ({ style }: { style?: React.CSSProperties }) => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" style={style}>\n <path d=\"M14.5 3H7.71l-.85-.85L6.5 2h-5l-.5.5v11l.5.5h13l.5-.5v-10l-.5-.5zm-.5 10H2V6h12v7zm0-8H2V3h4.29l.85.85.36.15H14v1z\" />\n </svg>\n);\n\nexport const PanelLeftIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M2 2v12h12V2H2zm11 11H6V3h7v10zM3 3h2v10H3V3z\" />\n </svg>\n);\n\nexport const PanelRightIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M2 2v12h12V2H2zm6 11V3h5v10H8zM3 3h4v10H3V3z\" />\n </svg>\n);\n\nexport const SunIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z\" />\n </svg>\n);\n\nexport const MoonIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z\" />\n </svg>\n);\n","import { view, prop } from '@vscode/observables-react';\nimport { styles } from './styles.js';\nimport { TitleBarButton } from './TitleBarButton.js';\nimport { PanelLeftIcon, PanelRightIcon, SunIcon, MoonIcon } from './icons.js';\nimport type { ExplorerModel, ViewMode } from './ExplorerModel.js';\n\nconst ViewModeSelector = view(\n { model: prop.const<ExplorerModel>() },\n (reader, props) => {\n const model = props.model;\n const viewMode = model.viewMode.read(reader);\n\n const sessions = model.daemon?.sessions.read(reader) ?? [];\n const currentSession = model.daemon?.sessionName;\n const otherSessions = sessions.filter(s => s.name !== currentSession);\n\n if (sessions.length <= 1) return null;\n\n return (\n <div style={viewModeStyles.container}>\n <div style={viewModeStyles.segmentedControl}>\n <ViewModeButton label=\"Live\" mode=\"session\" active={viewMode === 'session'} onClick={() => model.setViewMode('session')} />\n <ViewModeButton label=\"Diff\" mode=\"diff\" active={viewMode === 'diff'} onClick={() => model.setViewMode('diff')} />\n </div>\n {otherSessions.length > 0 && (\n <div style={viewModeStyles.sessionLinks}>\n {otherSessions.map(s => (\n <button\n key={s.name}\n style={viewModeStyles.sessionLink}\n onClick={() => model.navigateToSession(s.name)}\n title={`Switch to ${s.name} session`}\n >\n → {s.name}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n }\n);\n\nfunction ViewModeButton({ label, mode, active, onClick }: {\n label: string; mode: ViewMode; active: boolean; onClick: () => void;\n}) {\n return (\n <button\n style={active ? viewModeStyles.segmentActive : viewModeStyles.segment}\n onClick={onClick}\n >\n {label}\n </button>\n );\n}\n\nexport const TitleBar = view(\n {\n model: prop.const<ExplorerModel>(),\n },\n (reader, props) => {\n const model = props.model;\n const leftVisible = model.leftSidebarVisible.read(reader);\n const rightVisible = model.rightSidebarVisible.read(reader);\n const isDarkTheme = model.isDarkTheme.read(reader);\n const selectedNode = model.selectedNode.read(reader);\n\n return (\n <div style={styles.titleBar}>\n <div style={styles.titleBarSection}>\n <TitleBarButton\n active={leftVisible}\n onClick={model.toggleLeftSidebar}\n title=\"Toggle left sidebar\"\n >\n <PanelLeftIcon />\n </TitleBarButton>\n </div>\n <div style={styles.titleBarCenter}>\n {model.isReportMode ? (\n <span style={{ fontSize: 12, color: 'var(--component-explorer-descriptionForeground)' }}>\n Screenshot Report\n </span>\n ) : model.daemonAvailable ? (\n <ViewModeSelector model={model} />\n ) : null}\n {selectedNode ? (\n <>\n <span style={{ color: 'var(--component-explorer-textLink-foreground)' }}>&lt;</span>\n <span>{selectedNode.name}</span>\n <span style={{ color: 'var(--component-explorer-textLink-foreground)' }}>/&gt;</span>\n </>\n ) : (\n <span style={{ color: 'var(--component-explorer-descriptionForeground)' }}>No component selected</span>\n )}\n </div>\n <div style={styles.titleBarSection}>\n <TitleBarButton\n active={false}\n onClick={model.toggleTheme}\n title={isDarkTheme ? 'Switch to light theme' : 'Switch to dark theme'}\n >\n {isDarkTheme ? <SunIcon /> : <MoonIcon />}\n </TitleBarButton>\n <TitleBarButton\n active={rightVisible}\n onClick={model.toggleRightSidebar}\n title=\"Toggle right sidebar\"\n >\n <PanelRightIcon />\n </TitleBarButton>\n </div>\n </div>\n );\n }\n);\n\nconst viewModeStyles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n marginRight: 12,\n } as React.CSSProperties,\n segmentedControl: {\n display: 'flex',\n borderRadius: 4,\n overflow: 'hidden',\n border: '1px solid var(--component-explorer-panel-border)',\n } as React.CSSProperties,\n segment: {\n padding: '2px 10px',\n fontSize: 11,\n fontWeight: 500,\n border: 'none',\n background: 'transparent',\n color: 'var(--component-explorer-descriptionForeground)',\n cursor: 'pointer',\n } as React.CSSProperties,\n segmentActive: {\n padding: '2px 10px',\n fontSize: 11,\n fontWeight: 500,\n border: 'none',\n background: 'var(--component-explorer-button-background)',\n color: 'var(--component-explorer-button-foreground)',\n cursor: 'pointer',\n } as React.CSSProperties,\n sessionLinks: {\n display: 'flex',\n gap: 4,\n } as React.CSSProperties,\n sessionLink: {\n padding: '2px 8px',\n fontSize: 11,\n border: '1px solid var(--component-explorer-panel-border)',\n borderRadius: 4,\n background: 'transparent',\n color: 'var(--component-explorer-textLink-foreground)',\n cursor: 'pointer',\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { view, viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { styles, mergeStyles } from './styles.js';\nimport { ChevronRightIcon, ChevronDownIcon, ComponentIcon, FolderIcon } from './icons.js';\nimport type { ExplorerModel } from './ExplorerModel.js';\nimport type { ExplorerTreeNode } from './types.js';\n\nconst labelContainerStyle: React.CSSProperties = {\n display: 'flex',\n gap: '3px',\n marginLeft: '6px',\n overflow: 'hidden',\n flexShrink: 1,\n minWidth: 0,\n};\n\nfunction countFixtures(node: ExplorerTreeNode): number {\n if (node.type === 'component') { return 1; }\n return (node.children ?? []).reduce((sum, child) => sum + countFixtures(child), 0);\n}\n\nconst labelBadgeStyle: React.CSSProperties = {\n fontSize: '10px',\n lineHeight: '14px',\n padding: '0 4px',\n borderRadius: '2px',\n backgroundColor: 'var(--component-explorer-badge-background)',\n color: 'var(--component-explorer-badge-foreground)',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n maxWidth: '60px',\n cursor: 'pointer',\n};\n\n// TreeView - renders a list of nodes\nexport const TreeView = view(\n {\n model: prop.const<ExplorerModel>(),\n nodes: prop.const<readonly ExplorerTreeNode[]>(),\n depth: prop.const<number>(),\n },\n (_reader, props) => (\n <>\n {props.nodes.map((node) => (\n <TreeItem key={node.id.value} model={props.model} node={node} depth={props.depth} />\n ))}\n </>\n )\n);\n\n// TreeItem - ViewModel for hover state\nclass TreeItemModel extends ViewModel({\n model: prop.const<ExplorerModel>(),\n node: prop.const<ExplorerTreeNode>(),\n depth: prop.const<number>(),\n}) {\n readonly isHovered = observableValue<boolean>(this, false);\n\n // Expose props for render function\n get explorerModel(): ExplorerModel { return this.props.model; }\n get treeNode(): ExplorerTreeNode { return this.props.node; }\n get treeDepth(): number { return this.props.depth; }\n\n setHovered = (hovered: boolean): void => {\n this.isHovered.set(hovered, undefined);\n };\n\n handleClick = (): void => {\n this.props.model.selectNode(this.props.node.id.value);\n };\n\n handleDoubleClick = (): void => {\n if (this._hasChildren) {\n this.props.model.toggleNodeExpanded(this.props.node.id.value);\n }\n };\n\n handleChevronClick = (e: React.MouseEvent): void => {\n e.stopPropagation();\n this.props.model.toggleNodeExpanded(this.props.node.id.value);\n };\n\n private get _hasChildren(): boolean {\n return !!(this.props.node.children && this.props.node.children.length > 0);\n }\n}\n\nexport const TreeItem = viewWithModel(TreeItemModel, {}, (reader, itemModel) => {\n const model = itemModel.explorerModel;\n const node = itemModel.treeNode;\n const depth = itemModel.treeDepth;\n const hasChildren = !!(node.children && node.children.length > 0);\n const isExpanded = hasChildren ? model.isNodeExpanded(node.id.value, reader) : false;\n const selectedId = model.selectedNodeId.read(reader);\n const isSelected = selectedId === node.id.value;\n const isHovered = itemModel.isHovered.read(reader);\n\n const itemStyle = mergeStyles(\n styles.treeItem,\n { paddingLeft: `${8 + depth * 12}px` },\n isSelected && styles.treeItemSelected,\n !isSelected && isHovered && styles.treeItemHover,\n );\n\n return (\n <>\n <div\n style={itemStyle}\n onClick={itemModel.handleClick}\n onDoubleClick={itemModel.handleDoubleClick}\n onMouseEnter={() => itemModel.setHovered(true)}\n onMouseLeave={() => itemModel.setHovered(false)}\n >\n {hasChildren ? (\n <div style={styles.treeItemChevron} onClick={itemModel.handleChevronClick}>\n {isExpanded ? <ChevronDownIcon /> : <ChevronRightIcon />}\n </div>\n ) : (\n <div style={styles.treeItemChevronPlaceholder} />\n )}\n <div style={styles.treeItemIcon}>\n {node.type === 'folder' \n ? <FolderIcon style={{ color: 'var(--component-explorer-symbolIcon-folderForeground)' }} />\n : <ComponentIcon style={{ color: '#deb45b' }} />\n }\n </div>\n <span style={styles.treeItemLabel}>{node.name}</span>\n {node.labels.some(l => !l.startsWith('.')) && (\n <span style={labelContainerStyle}>\n {node.labels.filter(l => !l.startsWith('.')).map((label) => (\n <span\n key={label}\n style={labelBadgeStyle}\n onClick={(e) => { e.stopPropagation(); model.searchQuery.set(label, undefined); }}\n title={label}\n >\n {label}\n </span>\n ))}\n </span>\n )}\n {node.type === 'folder' && hasChildren && (\n <span style={styles.treeItemCount}>{countFixtures(node)}</span>\n )}\n </div>\n {hasChildren && isExpanded && (\n <TreeView model={model} nodes={node.children!} depth={depth + 1} />\n )}\n </>\n );\n});\n","import * as React from 'react';\nimport { view, prop } from '@vscode/observables-react';\nimport type { ExplorerModel } from './ExplorerModel.js';\n\nconst searchContainerStyle: React.CSSProperties = {\n\tpadding: '4px 8px',\n\tborderBottom: '1px solid var(--component-explorer-panel-border)',\n};\n\nconst searchInputStyle: React.CSSProperties = {\n\twidth: '100%',\n\theight: '24px',\n\tpadding: '0 22px 0 6px',\n\tfontSize: '12px',\n\tcolor: 'var(--component-explorer-input-foreground)',\n\tbackgroundColor: 'var(--component-explorer-input-background)',\n\tborder: '1px solid var(--component-explorer-input-border, transparent)',\n\tborderRadius: '2px',\n\toutline: 'none',\n\tboxSizing: 'border-box',\n};\n\nconst searchWrapperStyle: React.CSSProperties = {\n\tposition: 'relative',\n};\n\nconst clearButtonStyle: React.CSSProperties = {\n\tposition: 'absolute',\n\tright: '2px',\n\ttop: '50%',\n\ttransform: 'translateY(-50%)',\n\tdisplay: 'flex',\n\talignItems: 'center',\n\tjustifyContent: 'center',\n\twidth: '18px',\n\theight: '18px',\n\tborder: 'none',\n\tbackground: 'transparent',\n\tcolor: 'var(--component-explorer-input-foreground)',\n\tcursor: 'pointer',\n\tborderRadius: '2px',\n\tfontSize: '14px',\n\topacity: 0.7,\n};\n\nexport const SearchInput = view(\n\t{\n\t\tmodel: prop.const<ExplorerModel>(),\n\t},\n\t(reader, props) => {\n\t\tconst query = props.model.searchQuery.read(reader);\n\t\treturn (\n\t\t\t<div style={searchContainerStyle}>\n\t\t\t\t<div style={searchWrapperStyle}>\n\t\t\t\t\t<input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tplaceholder=\"Filter (name or label)\"\n\t\t\t\t\t\tstyle={searchInputStyle}\n\t\t\t\t\t\tvalue={query ?? ''}\n\t\t\t\t\t\tonChange={(e) => props.model.searchQuery.set(e.target.value || undefined, undefined)}\n\t\t\t\t\t\tonFocus={(e) => (e.target.style.borderColor = 'var(--component-explorer-focusBorder)')}\n\t\t\t\t\t\tonBlur={(e) => (e.target.style.borderColor = 'var(--component-explorer-input-border, transparent)')}\n\t\t\t\t\t/>\n\t\t\t\t\t{query && (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tstyle={clearButtonStyle}\n\t\t\t\t\t\t\tonClick={() => props.model.searchQuery.set(undefined, undefined)}\n\t\t\t\t\t\t\ttitle=\"Clear filter\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t×\n\t\t\t\t\t\t</button>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n","import { view, prop } from '@vscode/observables-react';\nimport { styles } from './styles.js';\nimport { TreeView } from './TreeView.js';\nimport type { ExplorerModel } from './ExplorerModel.js';\nimport { SearchInput } from './SearchInput.js';\n\nexport const LeftSidebar = view(\n {\n model: prop.const<ExplorerModel>(),\n },\n (reader, props) => {\n const tree = props.model.filteredTree.read(reader);\n return (\n <div style={styles.sidebar}>\n <div style={styles.sidebarHeader}>Explorer</div>\n <SearchInput model={props.model} />\n <div style={styles.sidebarContent}>\n <TreeView model={props.model} nodes={[tree]} depth={0} />\n </div>\n </div>\n );\n }\n);\n","import * as React from 'react';\nimport { view, prop } from '@vscode/observables-react';\nimport type { IReader } from '@vscode/observables';\nimport { styles, mergeStyles } from './styles.js';\nimport type { ExplorerModel } from './ExplorerModel.js';\nimport {\n aggregateInputProperties,\n type AggregatedInputProperty,\n type FixtureInputStore,\n type IJsonSchema,\n} from '../core/index.js';\n\n/** Resolves the value shared by every fixture of a property. */\nfunction readSharedValue(\n reader: IReader,\n store: FixtureInputStore,\n property: AggregatedInputProperty,\n): { value: unknown; mixed: boolean } {\n return { value: store.readValue(reader, property.name, property.schema), mixed: false };\n}\n\n/** Short, human-readable type annotation shown next to a property name. */\nfunction describeType(schema: IJsonSchema): string {\n if (schema.enum) { return 'enum'; }\n if (schema.type === 'integer') { return 'number'; }\n return schema.type ?? 'value';\n}\n\n/** Renders the input element appropriate for the property's JSON Schema. */\nfunction renderControl(\n schema: IJsonSchema,\n value: unknown,\n mixed: boolean,\n setValue: (next: unknown) => void,\n): React.ReactNode {\n // Enumerations → dropdown.\n if (schema.enum && schema.enum.length > 0) {\n const current = mixed ? '' : String(value ?? '');\n return (\n <select\n style={styles.propertySelect as React.CSSProperties}\n value={current}\n onChange={(e) => {\n const raw = e.target.value;\n const match = schema.enum!.find((o) => String(o) === raw);\n setValue(match);\n }}\n >\n {mixed && <option value=\"\">— mixed —</option>}\n {schema.enum.map((option) => (\n <option key={String(option)} value={String(option)}>{String(option)}</option>\n ))}\n </select>\n );\n }\n\n // Booleans → checkbox (indeterminate when mixed).\n if (schema.type === 'boolean') {\n return (\n <input\n type=\"checkbox\"\n ref={(el) => { if (el) { el.indeterminate = mixed; } }}\n checked={value === true}\n onChange={(e) => setValue(e.target.checked)}\n />\n );\n }\n\n // Numbers → number input.\n if (schema.type === 'number' || schema.type === 'integer') {\n return (\n <input\n type=\"number\"\n style={styles.propertyInput as React.CSSProperties}\n value={mixed ? '' : (value === undefined || value === null ? '' : String(value))}\n placeholder={mixed ? 'mixed' : undefined}\n onChange={(e) => {\n const raw = e.target.value;\n if (raw === '') { setValue(undefined); return; }\n const parsed = schema.type === 'integer' ? parseInt(raw, 10) : parseFloat(raw);\n if (!Number.isNaN(parsed)) { setValue(parsed); }\n }}\n />\n );\n }\n\n // Strings (and unknown) → text input.\n if (schema.type === 'string' || schema.type === undefined) {\n return (\n <input\n type=\"text\"\n style={styles.propertyInput as React.CSSProperties}\n value={mixed ? '' : (value === undefined || value === null ? '' : String(value))}\n placeholder={mixed ? 'mixed' : 'Enter value…'}\n onChange={(e) => setValue(e.target.value)}\n />\n );\n }\n\n // Fallback: edit raw JSON.\n return (\n <input\n type=\"text\"\n style={styles.propertyInput as React.CSSProperties}\n value={mixed ? '' : (value === undefined ? '' : JSON.stringify(value))}\n placeholder={mixed ? 'mixed' : 'JSON value…'}\n onChange={(e) => {\n try {\n setValue(e.target.value === '' ? undefined : JSON.parse(e.target.value));\n } catch {\n /* keep typing until valid JSON */\n }\n }}\n />\n );\n}\n\n/** A single labelled control bound to one aggregated input property across all its fixtures. */\nconst PropertyControl = view(\n {\n model: prop.const<ExplorerModel>(),\n property: prop.const<AggregatedInputProperty>(),\n },\n (reader, props) => {\n const { property, model } = props;\n const { name, schema, fixtureIds } = property;\n const store = model.inputStore;\n const { value, mixed } = readSharedValue(reader, store, property);\n\n const setValue = (next: unknown): void => {\n store.setValue(name, schema, next);\n };\n\n return (\n <div style={styles.propertyRow}>\n <div style={styles.propertyLabel}>\n {name}\n <span style={{ color: 'var(--component-explorer-descriptionForeground)' }}> : {describeType(schema)}</span>\n </div>\n {renderControl(schema, value, mixed, setValue)}\n {schema.description && <div style={styles.propertyDescription}>{schema.description}</div>}\n {fixtureIds.length > 1 && (\n <div style={styles.propertyDescription}>Applies to {fixtureIds.length} rendered fixtures</div>\n )}\n </div>\n );\n }\n);\n\n/**\n * Properties panel: aggregates the input schemas of every fixture currently rendered in the\n * preview area and presents one control per shared property. Editing a control updates the\n * `input` of all fixtures that declare that property (same name + schema), so common values\n * like a theme can be switched across the whole view at once.\n */\nexport const RightSidebar = view(\n {\n model: prop.const<ExplorerModel>(),\n },\n (reader, props) => {\n const model = props.model;\n const fixtures = model.renderedFixtures.read(reader);\n const properties = aggregateInputProperties(\n fixtures.map((f) => ({ id: f.id, inputSchema: f.component.inputSchema })),\n ).filter(property => property.fixtureIds.some(fixtureId => {\n const fixture = fixtures.find(candidate => candidate.id === fixtureId);\n return fixture?.component.inputControls?.[property.name]?.placement !== 'toolbar';\n }));\n\n return (\n <div style={mergeStyles(styles.sidebar, styles.sidebarRight)}>\n <div style={styles.sidebarHeader}>\n <span style={{ marginRight: '6px', color: 'var(--component-explorer-textLink-foreground)' }}>&lt;/&gt;</span>\n Props\n </div>\n <div style={styles.sidebarContent}>\n {fixtures.length === 0 ? (\n <div style={emptyStyle}>Select a component or folder to preview</div>\n ) : properties.length === 0 ? (\n <div style={emptyStyle}>The rendered fixtures declare no configurable inputs.</div>\n ) : (\n <div style={styles.propertiesPanel}>\n {properties.map((property) => (\n <PropertyControl\n key={`${property.name}:${property.fixtureIds.join(',')}`}\n model={model}\n property={property}\n />\n ))}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nconst emptyStyle: React.CSSProperties = {\n padding: '12px',\n color: 'var(--component-explorer-descriptionForeground)',\n fontSize: '12px',\n};\n","import { z } from 'zod';\n\nconst renderEventTypeSchema = z.enum([\n 'console.error', 'console.warn', 'console.log',\n 'window.error', 'window.unhandledrejection',\n 'thrownError',\n]);\nconst renderEventSchema = z.object({\n type: renderEventTypeSchema,\n phase: z.enum(['render', 'dispose']),\n isError: z.boolean(),\n message: z.string(),\n stack: z.string().optional(),\n});\nconst coverageRefSchema = z.object({\n /**\n * Path (relative to manifest.json) to a JSON file in the standard Istanbul\n * `coverage-final.json` format: `Record<absolutePath, IFileCoverage>`.\n * Compatible with `istanbul-lib-coverage`, `nyc`, and the `coverage-viewer`.\n *\n * When CSS coverage is collected, CSS files are merged into the same map\n * (one statement per non-blank line) so they appear as ordinary source files.\n */\n coverageDataIstanbul: z.string().optional(),\n}).describe('References to coverage report files emitted alongside the manifest');\nconst RenderManifestSchema = z.object({\n version: z.literal(1),\n repository: z.object({\n owner: z.string(),\n name: z.string(),\n }),\n commit: z.object({\n hash: z.string(),\n parentHashes: z.array(z.string()),\n author: z.object({\n name: z.string(),\n email: z.string(),\n }),\n timestamp: z.string(),\n message: z.string(),\n }),\n /** Aggregated coverage across all fixtures (always present when coverage was collected). */\n coverage: coverageRefSchema.optional(),\n fixtures: z.array(z.object({\n fixtureId: z.string(),\n imageHash: z.string().optional(),\n imagePath: z.string().optional(),\n background: z.enum([\"light\", \"dark\"]),\n labels: z.array(z.string()),\n expectedVisualDescriptions: z.array(z.string()),\n /** `true` iff at least one event in `events` has `isError: true`. */\n hasError: z.boolean(),\n events: z.array(renderEventSchema),\n renderTimeMs: z.object({\n sync: z.number(),\n total: z.number(),\n }),\n /** Arbitrary data the fixture provided via `RenderResult.output`. */\n output: z.unknown().optional(),\n /** Coverage attributable to this fixture (only present in per-fixture coverage mode). */\n coverage: coverageRefSchema.optional(),\n })),\n});\nconst MANIFEST_FILENAME = \"manifest.json\";\nfunction generateRenderManifestJsonSchema() {\n return z.toJSONSchema(RenderManifestSchema, { target: 'draft-2020-12' });\n}\n\nexport { MANIFEST_FILENAME, RenderManifestSchema, generateRenderManifestJsonSchema };\n//# sourceMappingURL=renderManifest.js.map\n","/**\n * Builds a URL for the Component Explorer.\n * The caller supplies `pathname`; `baseQuery` is preserved with `mode`/`fixture` applied on top.\n */\nfunction buildExplorerUrl(options) {\n const params = options.baseQuery instanceof URLSearchParams\n ? new URLSearchParams(options.baseQuery)\n : new URLSearchParams(options.baseQuery ?? '');\n if (options.mode !== undefined) {\n params.set('mode', options.mode);\n }\n if (options.fixtureId !== undefined) {\n params.set('fixture', options.fixtureId);\n }\n const queryString = params.toString();\n const base = `${options.baseUrl ?? ''}${options.pathname}`;\n return queryString ? `${base}?${queryString}` : base;\n}\n\nexport { buildExplorerUrl };\n//# sourceMappingURL=explorerUrl.js.map\n","const MAX_ENTRIES = 500;\n\ntype CachedHeights = Record<string, number>;\n\nfunction createHeightCache(storageKey: string) {\n let _cache: CachedHeights | null = null;\n\n function load(): CachedHeights {\n if (_cache !== null) return _cache;\n try {\n const stored = localStorage.getItem(storageKey);\n if (stored) {\n _cache = JSON.parse(stored);\n return _cache!;\n }\n } catch { /* ignore */ }\n _cache = {};\n return _cache;\n }\n\n function save(): void {\n if (_cache === null) return;\n try {\n const entries = Object.entries(_cache);\n if (entries.length > MAX_ENTRIES) {\n _cache = Object.fromEntries(entries.slice(-MAX_ENTRIES));\n }\n localStorage.setItem(storageKey, JSON.stringify(_cache));\n } catch { /* ignore */ }\n }\n\n return {\n get(id: string): number | undefined { return load()[id]; },\n set(id: string, height: number): void { load()[id] = height; save(); },\n getAll(): ReadonlyMap<string, number> { return new Map(Object.entries(load())); },\n };\n}\n\nconst _rowHeights = createHeightCache('component-explorer:fixtureHeights');\nconst _contentHeights = createHeightCache('component-explorer:fixtureContentHeights');\n\nexport function setCachedHeight(fixtureId: string, height: number): void { _rowHeights.set(fixtureId, height); }\nexport function getCachedHeight(fixtureId: string): number | undefined { return _rowHeights.get(fixtureId); }\nexport function getAllCachedHeights(): ReadonlyMap<string, number> { return _rowHeights.getAll(); }\n\nexport function setCachedContentHeight(fixtureId: string, height: number): void { _contentHeights.set(fixtureId, height); }\nexport function getCachedContentHeight(fixtureId: string): number | undefined { return _contentHeights.get(fixtureId); }\n\nconst _contentWidths = createHeightCache('component-explorer:fixtureContentWidths');\n\nexport function setCachedContentWidth(fixtureId: string, width: number): void { _contentWidths.set(fixtureId, width); }\nexport function getCachedContentWidth(fixtureId: string): number | undefined { return _contentWidths.get(fixtureId); }\n","import { observableValue, type IObservable, type ISettableObservable, type IReader, derived } from '@vscode/observables';\nimport type { RenderEventType } from './ErrorInfo.js';\n\nexport interface ConsoleEvent {\n\treadonly id: number;\n\treadonly timestamp: number;\n\treadonly type: RenderEventType;\n\treadonly message: string;\n\treadonly stack?: string;\n}\n\nlet _nextEventId = 0;\n\n/**\n * Global store for console events (console.error, console.warn, window errors, unhandled rejections).\n * Events are captured globally and cannot be attributed to specific fixtures since they render in parallel.\n */\nexport class ConsoleEventsStore {\n\tprivate static _instance: ConsoleEventsStore | undefined;\n\n\tstatic getInstance(): ConsoleEventsStore {\n\t\tif (!this._instance) {\n\t\t\tthis._instance = new ConsoleEventsStore();\n\t\t}\n\t\treturn this._instance;\n\t}\n\n\tprivate readonly _events: ISettableObservable<readonly ConsoleEvent[]>;\n\tprivate _installed = false;\n\tprivate _originalConsoleError: typeof console.error | undefined;\n\tprivate _originalConsoleWarn: typeof console.warn | undefined;\n\n\tprivate constructor() {\n\t\tthis._events = observableValue<readonly ConsoleEvent[]>(this, []);\n\t}\n\n\tget events(): IObservable<readonly ConsoleEvent[]> {\n\t\treturn this._events;\n\t}\n\n\tget errorCount(): { read(reader: IReader): number } {\n\t\treturn derived(this, reader => {\n\t\t\tconst events = this._events.read(reader);\n\t\t\treturn events.filter((e: ConsoleEvent) => e.type === 'console.error' || e.type === 'window.error' || e.type === 'window.unhandledrejection').length;\n\t\t});\n\t}\n\n\tinstall(): void {\n\t\tif (this._installed) return;\n\t\tthis._installed = true;\n\n\t\t// Intercept console.error\n\t\tthis._originalConsoleError = console.error;\n\t\tconsole.error = (...args: unknown[]) => {\n\t\t\tthis._addEvent('console.error', args.map(String).join(' '));\n\t\t\tthis._originalConsoleError!.apply(console, args);\n\t\t};\n\n\t\t// Intercept console.warn\n\t\tthis._originalConsoleWarn = console.warn;\n\t\tconsole.warn = (...args: unknown[]) => {\n\t\t\tthis._addEvent('console.warn', args.map(String).join(' '));\n\t\t\tthis._originalConsoleWarn!.apply(console, args);\n\t\t};\n\n\t\t// Listen for window errors\n\t\twindow.addEventListener('error', (event) => {\n\t\t\tthis._addEvent('window.error', event.message, event.error?.stack);\n\t\t});\n\n\t\t// Listen for unhandled promise rejections\n\t\twindow.addEventListener('unhandledrejection', (event) => {\n\t\t\tconst reason = event.reason;\n\t\t\tconst message = reason instanceof Error ? reason.message : String(reason);\n\t\t\tconst stack = reason instanceof Error ? reason.stack : undefined;\n\t\t\tthis._addEvent('window.unhandledrejection', message, stack);\n\t\t});\n\t}\n\n\tprivate _addEvent(type: RenderEventType, message: string, stack?: string): void {\n\t\tconst event: ConsoleEvent = {\n\t\t\tid: _nextEventId++,\n\t\t\ttimestamp: Date.now(),\n\t\t\ttype,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t};\n\t\tthis._events.set([...this._events.get(), event], undefined);\n\t}\n\n\t/**\n\t * Add an event programmatically (e.g., forwarded from an iframe).\n\t */\n\taddEvent(type: RenderEventType, message: string, stack?: string): void {\n\t\tthis._addEvent(type, message, stack);\n\t}\n\n\tclear(): void {\n\t\tthis._events.set([], undefined);\n\t}\n}\n","import {\n isInteractiveOutput,\n type DebugPanelActivation,\n type DebugPanelChannel,\n type IDisposable,\n} from './fixtureApi.js';\n\nexport const OUTPUT_DEBUG_PANEL_ID = '$output';\n\nexport interface ActiveDebugPanelSession extends IDisposable {\n sendAction(action: unknown): void;\n}\n\ntype InputListener = (value: unknown, input: unknown) => void;\n\nexport class FixtureInputRuntime {\n private readonly _listeners = new Map<string, Set<InputListener>>();\n\n constructor(private _input: unknown) {}\n\n watch(key: string, listener: InputListener): IDisposable {\n let listeners = this._listeners.get(key);\n if (!listeners) {\n listeners = new Set();\n this._listeners.set(key, listeners);\n }\n listeners.add(listener);\n listener(readProperty(this._input, key), this._input);\n\n let disposed = false;\n return {\n dispose: () => {\n if (disposed) return;\n disposed = true;\n listeners.delete(listener);\n if (listeners.size === 0) {\n this._listeners.delete(key);\n }\n },\n };\n }\n\n update(input: unknown): boolean {\n const changedKeys = getChangedKeys(this._input, input);\n if (changedKeys.length === 0) {\n this._input = input;\n return true;\n }\n if (changedKeys.some(key => !this._listeners.has(key))) {\n return false;\n }\n\n this._input = input;\n for (const key of changedKeys) {\n const listeners = this._listeners.get(key);\n if (!listeners) continue;\n const value = readProperty(input, key);\n for (const listener of [...listeners]) {\n listener(value, input);\n }\n }\n return true;\n }\n}\n\nexport class FixtureDebugRuntime implements IDisposable {\n private readonly _activations = new Map<string, DebugPanelActivation<unknown, unknown>>();\n private readonly _activeSessions = new Set<ActiveDebugPanelSession>();\n private _output: unknown;\n private _hasOutput = false;\n\n connect(\n panelId: string,\n activate: DebugPanelActivation<unknown, unknown>,\n ): IDisposable {\n if (this._activations.has(panelId)) {\n throw new Error(`Debug panel \"${panelId}\" is already connected`);\n }\n this._activations.set(panelId, activate);\n return {\n dispose: () => {\n if (this._activations.get(panelId) === activate) {\n this._activations.delete(panelId);\n }\n },\n };\n }\n\n setOutput(output: unknown): void {\n this._output = output;\n this._hasOutput = output !== undefined;\n }\n\n get hasOutput(): boolean {\n return this._hasOutput;\n }\n\n get outputEditable(): boolean {\n return isInteractiveOutput(this._output);\n }\n\n getOutputSnapshot(): unknown {\n return isInteractiveOutput(this._output)\n ? this._output.getSnapshot()\n : this._output;\n }\n\n activate(panelId: string, publish: (state: unknown) => void): ActiveDebugPanelSession {\n const actionListeners = new Set<(action: unknown) => void>();\n const channel: DebugPanelChannel<unknown, unknown> = {\n publish,\n onAction(listener) {\n actionListeners.add(listener);\n return {\n dispose: () => {\n actionListeners.delete(listener);\n },\n };\n },\n };\n\n let activation: void | IDisposable;\n if (panelId === OUTPUT_DEBUG_PANEL_ID) {\n activation = this._activateOutput(channel);\n } else {\n const provider = this._activations.get(panelId);\n if (!provider) {\n throw new Error(`Debug panel \"${panelId}\" is not connected`);\n }\n activation = provider(channel);\n }\n\n let disposed = false;\n const session: ActiveDebugPanelSession = {\n sendAction(action) {\n if (disposed) return;\n for (const listener of [...actionListeners]) {\n listener(action);\n }\n },\n dispose: () => {\n if (disposed) return;\n disposed = true;\n actionListeners.clear();\n this._activeSessions.delete(session);\n const result = activation?.dispose();\n if (result instanceof Promise) {\n result.catch(error => console.error('Failed to dispose debug panel activation', error));\n }\n },\n };\n this._activeSessions.add(session);\n return session;\n }\n\n dispose(): void {\n for (const session of [...this._activeSessions]) {\n session.dispose();\n }\n this._activations.clear();\n this._output = undefined;\n this._hasOutput = false;\n }\n\n private _activateOutput(\n channel: DebugPanelChannel<unknown, unknown>,\n ): void | IDisposable {\n if (!this._hasOutput) {\n throw new Error('Fixture has no output');\n }\n if (isInteractiveOutput(this._output)) {\n return this._output.activate(channel);\n }\n channel.publish(this._output);\n }\n}\n\nfunction readProperty(input: unknown, key: string): unknown {\n return isRecord(input) ? input[key] : undefined;\n}\n\nfunction getChangedKeys(previous: unknown, next: unknown): readonly string[] {\n const previousRecord = isRecord(previous) ? previous : {};\n const nextRecord = isRecord(next) ? next : {};\n const keys = new Set([...Object.keys(previousRecord), ...Object.keys(nextRecord)]);\n return [...keys].filter(key => !Object.is(previousRecord[key], nextRecord[key]));\n}\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n","import { ComponentDefinition, applyInputDefaults } from './fixtureApiConsumer.js';\nimport type {\n\tDebugPanelActivation,\n\tDebugPanelDefinition,\n\tIDisposable,\n\tRenderContext,\n\tRenderHost,\n\tRenderResult,\n\tStyleDefinition,\n} from './fixtureApi.js';\nimport type { ExceptionError, RenderEventType } from './ErrorInfo.js';\nimport { getCachedContentHeight, setCachedContentHeight, getCachedContentWidth, setCachedContentWidth } from '../lib/fixtureSizeCache.js';\nimport { ConsoleEventsStore } from './ConsoleEventsStore.js';\nimport {\n\tFixtureDebugRuntime,\n\tFixtureInputRuntime,\n\ttype ActiveDebugPanelSession,\n} from './FixtureInteractionRuntime.js';\n\n/** Maximum time a fixture render may take before it is reported as failed. */\nexport const RENDER_TIMEOUT_MS = 3000;\n\nfunction isPromise(value: unknown): value is Promise<void> {\n\treturn !!value && typeof (value as Promise<void>).then === 'function';\n}\n\nfunction injectStyles(\n\tstyles: readonly StyleDefinition[],\n\ttargetDoc: Document | ShadowRoot,\n): { injectedElements: HTMLElement[]; adoptedSheets: CSSStyleSheet[] } {\n\tconst injectedElements: HTMLElement[] = [];\n\tconst adoptedSheets: CSSStyleSheet[] = [];\n\tconst appendTarget = targetDoc instanceof ShadowRoot ? targetDoc : targetDoc.head;\n\tfor (const style of styles) {\n\t\tif (style.type === 'css') {\n\t\t\tconst styleEl = document.createElement('style');\n\t\t\tstyleEl.textContent = style.content;\n\t\t\tappendTarget.appendChild(styleEl);\n\t\t\tinjectedElements.push(styleEl);\n\t\t} else if (style.type === 'url') {\n\t\t\tconst linkEl = document.createElement('link');\n\t\t\tlinkEl.rel = 'stylesheet';\n\t\t\tlinkEl.href = style.href;\n\t\t\tappendTarget.appendChild(linkEl);\n\t\t\tinjectedElements.push(linkEl);\n\t\t} else if (style.type === 'adopted') {\n\t\t\ttargetDoc.adoptedStyleSheets = [...targetDoc.adoptedStyleSheets, style.sheet];\n\t\t\tadoptedSheets.push(style.sheet);\n\t\t}\n\t}\n\treturn { injectedElements, adoptedSheets };\n}\n\nfunction removeStyles(\n\tinjectedElements: HTMLElement[],\n\tadoptedSheets: CSSStyleSheet[],\n\ttargetDoc: Document | ShadowRoot,\n): void {\n\tfor (const el of injectedElements) {\n\t\tel.remove();\n\t}\n\tfor (const sheet of adoptedSheets) {\n\t\ttargetDoc.adoptedStyleSheets = targetDoc.adoptedStyleSheets.filter(s => s !== sheet);\n\t}\n}\n\nexport class ComponentRendering {\n\treadonly renderTarget: HTMLElement;\n\treadonly iframe: HTMLIFrameElement | null = null;\n\tprivate readonly _abortController = new AbortController();\n\tprivate _resolvedResult: RenderResult | { error: ExceptionError } | undefined;\n\tprivate _injectedElements: HTMLElement[] = [];\n\tprivate _adoptedSheets: CSSStyleSheet[] = [];\n\tprivate _styleTarget: Document | ShadowRoot = document;\n\tprivate readonly _disposables: IDisposable[] = [];\n\tprivate readonly _rendered: Promise<RenderResult | undefined>;\n\tprivate readonly _inputRuntime: FixtureInputRuntime;\n\tprivate readonly _debugRuntime = new FixtureDebugRuntime();\n\tprivate readonly _iframeActiveSessions = new Set<ActiveDebugPanelSession>();\n\tprivate readonly _iframePanelStateHandlers = new Map<string, (state: unknown) => void>();\n\tprivate _iframeHasOutput = false;\n\tprivate _iframeOutputEditable = false;\n\tprivate _nextIframePanelSessionId = 0;\n\tprivate _currentInput: unknown;\n\n\tconstructor(\n\t\thost: HTMLElement,\n\t\treadonly component: ComponentDefinition,\n\t\tprivate readonly _renderHost: RenderHost = { kind: 'headless', interactive: false },\n\t\tprivate readonly _input?: unknown,\n\t) {\n\t\tconst isolation = component.isolation;\n\t\tconst effectiveInput = applyInputDefaults(component.inputSchema, this._input);\n\t\tthis._currentInput = effectiveInput;\n\t\tthis._inputRuntime = new FixtureInputRuntime(effectiveInput);\n\n\t\tif (isolation === 'shadow-dom') {\n\t\t\tconst shadowRoot = host.attachShadow({ mode: 'open' });\n\t\t\tthis._styleTarget = shadowRoot;\n\t\t\tif (component.styles) {\n\t\t\t\tconst { injectedElements, adoptedSheets } = injectStyles(component.styles, shadowRoot);\n\t\t\t\tthis._injectedElements = injectedElements;\n\t\t\t\tthis._adoptedSheets = adoptedSheets;\n\t\t\t}\n\t\t\tthis.renderTarget = document.createElement('div');\n\t\t\tshadowRoot.appendChild(this.renderTarget);\n\t\t} else if (isolation === 'iframe') {\n\t\t\tconst iframe = document.createElement('iframe');\n\t\t\tiframe.style.border = 'none';\n\t\t\tiframe.style.display = 'block';\n\t\t\tconst isComponentMode = component.displayMode.type === 'component';\n\t\t\tif (isComponentMode) {\n\t\t\t\tiframe.style.width = (getCachedContentWidth(component.id) ?? 0) + 'px';\n\t\t\t} else {\n\t\t\t\tiframe.style.width = '100%';\n\t\t\t}\n\t\t\tiframe.style.height = (getCachedContentHeight(component.id) ?? 0) + 'px';\n\n\t\t\tconst url = new URL(location.pathname, location.origin);\n\t\t\turl.searchParams.set('mode', 'embedded');\n\t\t\turl.searchParams.set('fixture', component.id);\n\t\t\turl.searchParams.set('file', component.sourceFile);\n\t\t\tiframe.src = url.toString();\n\t\t\thost.appendChild(iframe);\n\t\t\tthis.iframe = iframe;\n\n\t\t\tlet resolveRendered: ((result: RenderResult | undefined) => void) | undefined;\n\t\t\tlet rejectRendered: ((error: ExceptionError) => void) | undefined;\n\t\t\tconst onMessage = (e: MessageEvent) => {\n\t\t\t\tif (e.source !== iframe.contentWindow) return;\n\t\t\t\tif (e.data?.type === 'component-explorer:resize') {\n\t\t\t\t\tconst height = e.data.height;\n\t\t\t\t\tconst width = e.data.width;\n\t\t\t\t\tiframe.style.height = height + 'px';\n\t\t\t\t\tsetCachedContentHeight(component.id, height);\n\t\t\t\t\tif (isComponentMode && width) {\n\t\t\t\t\t\tiframe.style.width = width + 'px';\n\t\t\t\t\t\tsetCachedContentWidth(component.id, width);\n\t\t\t\t\t}\n\t\t\t\t} else if (e.data?.type === 'component-explorer:error') {\n\t\t\t\t\tconst error = e.data.error as ExceptionError;\n\t\t\t\t\tthis._resolvedResult = { error };\n\t\t\t\t\trejectRendered?.(error);\n\t\t\t\t\trejectRendered = undefined;\n\t\t\t\t} else if (e.data?.type === 'component-explorer:console') {\n\t\t\t\t\t// Forward iframe console events to the global store\n\t\t\t\t\tConsoleEventsStore.getInstance().addEvent(\n\t\t\t\t\t\te.data.eventType as RenderEventType,\n\t\t\t\t\t\te.data.message,\n\t\t\t\t\t\te.data.stack\n\t\t\t\t\t);\n\t\t\t\t} else if (e.data?.type === 'component-explorer:ready') {\n\t\t\t\t\tthis._iframeHasOutput = e.data.hasOutput === true;\n\t\t\t\t\tthis._iframeOutputEditable = e.data.outputEditable === true;\n\t\t\t\t\tresolveRendered?.(undefined);\n\t\t\t\t\tresolveRendered = undefined;\n\t\t\t\t\trejectRendered = undefined;\n\t\t\t\t} else if (e.data?.type === 'component-explorer:embedded-loaded') {\n\t\t\t\t\tiframe.contentWindow?.postMessage({\n\t\t\t\t\t\ttype: 'component-explorer:embedded-init',\n\t\t\t\t\t\tinput: this._currentInput,\n\t\t\t\t\t\thost: this._renderHost,\n\t\t\t\t\t}, '*');\n\t\t\t\t} else if (e.data?.type === 'component-explorer:debug-panel-state') {\n\t\t\t\t\tconst sessionId = typeof e.data.sessionId === 'string' ? e.data.sessionId : '';\n\t\t\t\t\tthis._iframePanelStateHandlers.get(sessionId)?.(e.data.state);\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('message', onMessage);\n\t\t\tthis._abortController.signal.addEventListener('abort', () => {\n\t\t\t\twindow.removeEventListener('message', onMessage);\n\t\t\t});\n\n\t\t\tthis.renderTarget = iframe;\n\t\t\tthis._rendered = new Promise<RenderResult | undefined>((resolve, reject) => {\n\t\t\t\tresolveRendered = resolve;\n\t\t\t\trejectRendered = reject;\n\t\t\t});\n\t\t\treturn;\n\t\t} else {\n\t\t\tif (component.styles) {\n\t\t\t\tconst { injectedElements, adoptedSheets } = injectStyles(component.styles, document);\n\t\t\t\tthis._injectedElements = injectedElements;\n\t\t\t\tthis._adoptedSheets = adoptedSheets;\n\t\t\t}\n\t\t\tthis.renderTarget = document.createElement('div');\n\t\t\thost.appendChild(this.renderTarget);\n\t\t}\n\n\t\tlet rawResult: RenderResult | void | Promise<RenderResult | void>;\n\t\ttry {\n\t\t\tconst context = {\n\t\t\t\tfixtureId: component.id,\n\t\t\t\tsignal: this._abortController.signal,\n\t\t\t\taddDisposable: <T extends IDisposable>(d: T): T => { this._disposables.push(d); return d; },\n\t\t\t\twatchInput: (key: string, listener: (value: unknown, input: unknown) => void): IDisposable => {\n\t\t\t\t\tconst disposable = this._inputRuntime.watch(key, listener);\n\t\t\t\t\tthis._disposables.push(disposable);\n\t\t\t\t\treturn disposable;\n\t\t\t\t},\n\t\t\t\tdebug: {\n\t\t\t\t\tconnect: <TState, TAction>(\n\t\t\t\t\t\tpanel: DebugPanelDefinition<TState, TAction>,\n\t\t\t\t\t\tactivate: DebugPanelActivation<TState, TAction>,\n\t\t\t\t\t): IDisposable => this._connectDebugPanel(panel, activate),\n\t\t\t\t},\n\t\t\t\thost: this._renderHost,\n\t\t\t\tinput: effectiveInput,\n\t\t\t};\n\t\t\trawResult = component.render(this.renderTarget, context as RenderContext);\n\t\t} catch (err) {\n\t\t\tconst error: ExceptionError = {\n\t\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t\t\tstack: err instanceof Error ? err.stack : undefined,\n\t\t\t};\n\t\t\tthis._resolvedResult = { error };\n\t\t\tthis._rendered = Promise.reject(error);\n\t\t\treturn;\n\t\t}\n\n\t\tif (rawResult instanceof Promise) {\n\t\t\tthis._rendered = rawResult.then((resolved) => {\n\t\t\t\tif (this._abortController.signal.aborted) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst r = resolved?.dispose?.();\n\t\t\t\t\t\tif (isPromise(r)) {\n\t\t\t\t\t\t\tr.catch(() => { /* aborted; swallow */ });\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch { /* aborted; swallow */ }\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tthis._resolvedResult = resolved ?? undefined;\n\t\t\t\tthis._debugRuntime.setOutput(resolved?.output);\n\t\t\t\treturn this._resolvedResult as RenderResult | undefined;\n\t\t\t}).catch((err) => {\n\t\t\t\tconst error: ExceptionError = {\n\t\t\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t\t\t\tstack: err instanceof Error ? err.stack : undefined,\n\t\t\t\t};\n\t\t\t\tthis._resolvedResult = { error };\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t} else {\n\t\t\tthis._resolvedResult = (rawResult ?? undefined) as RenderResult | undefined;\n\t\t\tthis._debugRuntime.setOutput(this._resolvedResult?.output);\n\t\t\tthis._rendered = Promise.resolve(this._resolvedResult as RenderResult | undefined);\n\t\t}\n\t}\n\n\tupdateInput(input: unknown): boolean {\n\t\tconst effectiveInput = applyInputDefaults(this.component.inputSchema, input);\n\t\tthis._currentInput = effectiveInput;\n\t\tif (this.iframe) {\n\t\t\tthis.iframe.contentWindow?.postMessage({\n\t\t\t\ttype: 'component-explorer:embedded-input',\n\t\t\t\tinput: effectiveInput,\n\t\t\t}, '*');\n\t\t\treturn true;\n\t\t}\n\t\treturn this._inputRuntime.update(effectiveInput);\n\t}\n\n\tget hasOutput(): boolean {\n\t\treturn this.iframe ? this._iframeHasOutput : this._debugRuntime.hasOutput;\n\t}\n\n\tget outputEditable(): boolean {\n\t\treturn this.iframe ? this._iframeOutputEditable : this._debugRuntime.outputEditable;\n\t}\n\n\tgetOutputSnapshot(): unknown {\n\t\tif (this.iframe) {\n\t\t\tthrow new Error('Iframe output snapshots are available through an activated Output panel');\n\t\t}\n\t\treturn this._debugRuntime.getOutputSnapshot();\n\t}\n\n\tactivateDebugPanel(\n\t\tpanelId: string,\n\t\tpublish: (state: unknown) => void,\n\t): ActiveDebugPanelSession {\n\t\tif (!this.iframe) {\n\t\t\treturn this._debugRuntime.activate(panelId, publish);\n\t\t}\n\n\t\tconst sessionId = `${this.component.id}:${this._nextIframePanelSessionId++}`;\n\t\tthis._iframePanelStateHandlers.set(sessionId, publish);\n\t\tthis.iframe.contentWindow?.postMessage({\n\t\t\ttype: 'component-explorer:debug-panel-activate',\n\t\t\tsessionId,\n\t\t\tpanelId,\n\t\t}, '*');\n\n\t\tlet disposed = false;\n\t\tconst session: ActiveDebugPanelSession = {\n\t\t\tsendAction: (action) => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tthis.iframe?.contentWindow?.postMessage({\n\t\t\t\t\ttype: 'component-explorer:debug-panel-action',\n\t\t\t\t\tsessionId,\n\t\t\t\t\taction,\n\t\t\t\t}, '*');\n\t\t\t},\n\t\t\tdispose: () => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tdisposed = true;\n\t\t\t\tthis._iframeActiveSessions.delete(session);\n\t\t\t\tthis._iframePanelStateHandlers.delete(sessionId);\n\t\t\t\tthis.iframe?.contentWindow?.postMessage({\n\t\t\t\t\ttype: 'component-explorer:debug-panel-deactivate',\n\t\t\t\t\tsessionId,\n\t\t\t\t}, '*');\n\t\t\t},\n\t\t};\n\t\tthis._iframeActiveSessions.add(session);\n\t\treturn session;\n\t}\n\n\tprivate _connectDebugPanel<TState, TAction>(\n\t\tpanel: DebugPanelDefinition<TState, TAction>,\n\t\tactivate: DebugPanelActivation<TState, TAction>,\n\t): IDisposable {\n\t\tif (!this.component.debugPanels.some(candidate => candidate.id === panel.id)) {\n\t\t\tthrow new Error(`Debug panel \"${panel.id}\" is not declared by fixture \"${this.component.id}\"`);\n\t\t}\n\t\tconst disposable = this._debugRuntime.connect(\n\t\t\tpanel.id,\n\t\t\tactivate as DebugPanelActivation<unknown, unknown>,\n\t\t);\n\t\tthis._disposables.push(disposable);\n\t\treturn disposable;\n\t}\n\n\tasync waitForRendering(): Promise<RenderResult | undefined> {\n\t\tconst timeoutPromise = new Promise<never>((_, reject) => {\n\t\t\tconst id = setTimeout(() => {\n\t\t\t\treject(new Error(`Fixture timed out after ${RENDER_TIMEOUT_MS}ms`));\n\t\t\t}, RENDER_TIMEOUT_MS);\n\t\t\tthis._abortController.signal.addEventListener('abort', () => clearTimeout(id));\n\t\t});\n\t\ttry {\n\t\t\tconst result = await Promise.race([this._rendered, timeoutPromise]);\n\t\t\tawait Promise.race([result?.ready ?? Promise.resolve(), timeoutPromise]);\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tif (this._renderHost.kind === 'embedded') {\n\t\t\t\tconsole.error(err instanceof Error ? err.message : String(err));\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tdispose(): Promise<readonly ExceptionError[]> {\n\t\tthis._abortController.abort();\n\t\tfor (const session of [...this._iframeActiveSessions]) {\n\t\t\tsession.dispose();\n\t\t}\n\t\tthis._debugRuntime.dispose();\n\t\tconst errors: ExceptionError[] = [];\n\t\tconst captureError = (err: unknown): void => {\n\t\t\terrors.push({\n\t\t\t\tmessage: err instanceof Error ? err.message : String(err),\n\t\t\t\tstack: err instanceof Error ? err.stack : undefined,\n\t\t\t});\n\t\t};\n\n\t\tconst promises: Promise<void>[] = [];\n\t\tconst runDispose = (fn: () => void | Promise<void>): void => {\n\t\t\ttry {\n\t\t\t\tconst r = fn();\n\t\t\t\tif (isPromise(r)) {\n\t\t\t\t\tpromises.push(r.catch(captureError));\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tcaptureError(err);\n\t\t\t}\n\t\t};\n\n\t\tif (this._resolvedResult && !('error' in this._resolvedResult)) {\n\t\t\tconst fixtureDispose = this._resolvedResult.dispose;\n\t\t\tif (fixtureDispose) {\n\t\t\t\trunDispose(() => fixtureDispose.call(this._resolvedResult));\n\t\t\t}\n\t\t}\n\t\tthis._resolvedResult = undefined;\n\n\t\tfor (const d of this._disposables) {\n\t\t\trunDispose(() => d.dispose());\n\t\t}\n\t\tthis._disposables.length = 0;\n\n\t\ttry {\n\t\t\tremoveStyles(this._injectedElements, this._adoptedSheets, this._styleTarget);\n\t\t} catch (err) {\n\t\t\tcaptureError(err);\n\t\t}\n\n\t\tif (promises.length === 0) {\n\t\t\treturn Promise.resolve(errors);\n\t\t}\n\t\treturn Promise.all(promises).then(() => errors);\n\t}\n}\n","let _shadowHost: HTMLElement | undefined;\n\nexport function setExplorerShadowHost(host: HTMLElement): void {\n\t_shadowHost = host;\n}\n\nexport function getExplorerShadowHost(): HTMLElement {\n\tif (!_shadowHost) {\n\t\tthrow new Error('Explorer shadow host not initialized');\n\t}\n\treturn _shadowHost;\n}\n","const _fixtureContainers = new WeakSet<HTMLElement>();\n\nconst _originalFocus = HTMLElement.prototype.focus;\nHTMLElement.prototype.focus = function (this: HTMLElement, options?: FocusOptions) {\n\tif (!options?.preventScroll && isInsideFixtureContainer(this)) {\n\t\t_originalFocus.call(this, { ...options, preventScroll: true });\n\t} else {\n\t\t_originalFocus.call(this, options);\n\t}\n};\n\nfunction isInsideFixtureContainer(el: HTMLElement): boolean {\n\tlet node: Element | null = el;\n\twhile (node) {\n\t\tif (node instanceof HTMLElement && _fixtureContainers.has(node)) {\n\t\t\treturn true;\n\t\t}\n\t\tnode = node.parentElement;\n\t}\n\treturn false;\n}\n\nexport function registerFixtureContainer(container: HTMLElement): void {\n\t_fixtureContainers.add(container);\n}\n","import * as React from 'react';\nimport { observableValue } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { ConsoleEventsStore, type ConsoleEvent } from '../core/ConsoleEventsStore.js';\n\nclass ConsolePanelModel extends ViewModel({\n\tstore: prop.const<ConsoleEventsStore>(),\n}) {\n\treadonly expanded = observableValue(this, false);\n\n\tget store(): ConsoleEventsStore { return this.props.store; }\n\n\ttoggleExpanded(): void {\n\t\tthis.expanded.set(!this.expanded.get(), undefined);\n\t}\n\n\tclear(): void {\n\t\tthis.store.clear();\n\t}\n}\n\nexport const ConsolePanel = viewWithModel(\n\tConsolePanelModel,\n\t{ store: prop.const<ConsoleEventsStore>() },\n\t(reader, model) => {\n\t\tconst store = model.store;\n\t\tconst events = store.events.read(reader);\n\t\tconst errorCount = store.errorCount.read(reader);\n\t\tconst expanded = model.expanded.read(reader);\n\n\t\tif (events.length === 0) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<div style={panelStyles.container}>\n\t\t\t\t<button\n\t\t\t\t\tstyle={panelStyles.header}\n\t\t\t\t\tonClick={() => model.toggleExpanded()}\n\t\t\t\t>\n\t\t\t\t\t<span style={panelStyles.headerLeft}>\n\t\t\t\t\t\t<span style={panelStyles.chevron}>{expanded ? '▼' : '▶'}</span>\n\t\t\t\t\t\t<span>Console</span>\n\t\t\t\t\t\t{errorCount > 0 && (\n\t\t\t\t\t\t\t<span style={panelStyles.errorBadge}>{errorCount}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{events.length > errorCount && (\n\t\t\t\t\t\t\t<span style={panelStyles.warnBadge}>{events.length - errorCount}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\tstyle={panelStyles.clearButton}\n\t\t\t\t\t\tonClick={(e) => { e.stopPropagation(); model.clear(); }}\n\t\t\t\t\t\ttitle=\"Clear console\"\n\t\t\t\t\t>\n\t\t\t\t\t\tClear\n\t\t\t\t\t</button>\n\t\t\t\t</button>\n\t\t\t\t{expanded && (\n\t\t\t\t\t<div style={panelStyles.content}>\n\t\t\t\t\t\t{events.map((event: ConsoleEvent) => (\n\t\t\t\t\t\t\t<ConsoleEventRow key={event.id} event={event} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nfunction ConsoleEventRow({ event }: { event: ConsoleEvent }): React.ReactElement {\n\tconst [showStack, setShowStack] = React.useState(false);\n\tconst isError = event.type === 'console.error' || event.type === 'window.error' || event.type === 'window.unhandledrejection';\n\tconst isWarn = event.type === 'console.warn';\n\n\tconst time = new Date(event.timestamp);\n\tconst timeStr = time.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\t...rowStyles.container,\n\t\t\t\tbackgroundColor: isError ? 'rgba(255, 80, 80, 0.1)' : isWarn ? 'rgba(255, 200, 0, 0.1)' : 'transparent',\n\t\t\t\tborderLeft: `3px solid ${isError ? '#f55' : isWarn ? '#fc0' : 'transparent'}`,\n\t\t\t}}\n\t\t>\n\t\t\t<span style={rowStyles.time}>{timeStr}</span>\n\t\t\t<span style={{ ...rowStyles.type, color: isError ? '#f77' : isWarn ? '#fc0' : '#888' }}>\n\t\t\t\t{event.type.replace('window.', '').replace('console.', '')}\n\t\t\t</span>\n\t\t\t<span style={rowStyles.message}>\n\t\t\t\t{event.message}\n\t\t\t\t{event.stack && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={rowStyles.stackIndicator}\n\t\t\t\t\t\tonClick={() => setShowStack(!showStack)}\n\t\t\t\t\t\ttitle=\"Toggle stack trace\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{showStack ? ' ▴' : ' ▾'}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t\t{showStack && event.stack && (\n\t\t\t\t<pre style={rowStyles.stack}>{event.stack}</pre>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nconst panelStyles = {\n\tcontainer: {\n\t\tborderTop: '1px solid var(--component-explorer-panel-border)',\n\t\tbackgroundColor: 'var(--component-explorer-editor-background)',\n\t\tflexShrink: 0,\n\t} as React.CSSProperties,\n\theader: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tjustifyContent: 'space-between',\n\t\twidth: '100%',\n\t\tpadding: '6px 12px',\n\t\tbackgroundColor: 'var(--component-explorer-sideBar-background)',\n\t\tborder: 'none',\n\t\tcursor: 'pointer',\n\t\tfontSize: '12px',\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t\tfontFamily: 'inherit',\n\t} as React.CSSProperties,\n\theaderLeft: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: '8px',\n\t} as React.CSSProperties,\n\tchevron: {\n\t\tfontSize: '10px',\n\t\topacity: 0.7,\n\t} as React.CSSProperties,\n\terrorBadge: {\n\t\tbackgroundColor: '#f55',\n\t\tcolor: '#fff',\n\t\tfontSize: '10px',\n\t\tfontWeight: 600,\n\t\tpadding: '1px 6px',\n\t\tborderRadius: '10px',\n\t\tminWidth: '18px',\n\t\ttextAlign: 'center',\n\t} as React.CSSProperties,\n\twarnBadge: {\n\t\tbackgroundColor: '#a80',\n\t\tcolor: '#fff',\n\t\tfontSize: '10px',\n\t\tfontWeight: 600,\n\t\tpadding: '1px 6px',\n\t\tborderRadius: '10px',\n\t\tminWidth: '18px',\n\t\ttextAlign: 'center',\n\t} as React.CSSProperties,\n\tclearButton: {\n\t\tpadding: '2px 8px',\n\t\tfontSize: '11px',\n\t\tbackgroundColor: 'transparent',\n\t\tborder: '1px solid var(--component-explorer-button-border)',\n\t\tborderRadius: '3px',\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t\tcursor: 'pointer',\n\t\tfontFamily: 'inherit',\n\t} as React.CSSProperties,\n\tcontent: {\n\t\tmaxHeight: '200px',\n\t\toverflowY: 'auto',\n\t\tuserSelect: 'text',\n\t\tcursor: 'text',\n\t} as React.CSSProperties,\n};\n\nconst rowStyles = {\n\tcontainer: {\n\t\tdisplay: 'grid',\n\t\tgridTemplateColumns: 'auto auto 1fr',\n\t\tgap: '8px',\n\t\tpadding: '4px 12px',\n\t\tfontSize: '12px',\n\t\tfontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n\t\tborderBottom: '1px solid var(--component-explorer-panel-border)',\n\t} as React.CSSProperties,\n\ttime: {\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\topacity: 0.7,\n\t} as React.CSSProperties,\n\ttype: {\n\t\tfontWeight: 500,\n\t\tminWidth: '80px',\n\t} as React.CSSProperties,\n\tmessage: {\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t\twordBreak: 'break-word',\n\t} as React.CSSProperties,\n\tstackIndicator: {\n\t\tfontSize: '10px',\n\t\topacity: 0.5,\n\t\tcursor: 'pointer',\n\t\tuserSelect: 'none',\n\t} as React.CSSProperties,\n\tstack: {\n\t\tgridColumn: '1 / -1',\n\t\tmargin: '4px 0 0 0',\n\t\tpadding: '8px',\n\t\tbackgroundColor: 'rgba(0, 0, 0, 0.2)',\n\t\tborderRadius: '4px',\n\t\tfontSize: '11px',\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\twhiteSpace: 'pre-wrap',\n\t\twordBreak: 'break-word',\n\t\tlineHeight: 1.4,\n\t} as React.CSSProperties,\n};\n","import { autorun, observableValue, type IObservable, type IReader } from '@vscode/observables';\nimport type { CSSProperties, PointerEvent as ReactPointerEvent, ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { createRoot } from 'react-dom/client';\nimport { prop, ViewModel, viewWithModel } from '@vscode/observables-react';\nimport type { ConsoleEventsStore } from '../core/ConsoleEventsStore.js';\nimport type { DebugPanelDefinition, IDisposable } from '../core/fixtureApi.js';\nimport type { FixtureDebugInfo } from './FixtureDebugStore.js';\nimport {\n activateDebugEntry,\n dockDebugEntry,\n getVisibleDebugEntryKeys,\n reconcileDebugWorkbenchLayout,\n reorderDebugEntry,\n updateDebugSplitRatio,\n type DebugDockZone,\n type DebugSplitNode,\n type DebugStackNode,\n type DebugWorkbenchNode,\n} from './DebugWorkbenchLayout.js';\nimport { FixtureDebugStore } from './FixtureDebugStore.js';\nimport { OUTPUT_DEBUG_PANEL_ID } from '../core/FixtureInteractionRuntime.js';\nimport { ConsolePanel } from './ConsolePanel.js';\nimport type { DebugWorkbenchStateStore } from './DebugWorkbenchState.js';\n\nexport interface DebugWorkbenchEntry {\n readonly key: string;\n readonly title: string;\n readonly fixtureId: string;\n readonly fixtureName: string;\n readonly panelId: string;\n readonly definition?: DebugPanelDefinition;\n readonly outputEditable?: boolean;\n}\n\ninterface ConsoleWorkbenchEntry {\n readonly key: '$console';\n readonly title: 'Console';\n}\n\ntype WorkbenchEntry = DebugWorkbenchEntry | ConsoleWorkbenchEntry;\n\nexport interface DebugWorkbenchProps {\n readonly workbenchId: string;\n readonly entries: readonly DebugWorkbenchEntry[];\n readonly activeEntryKey: string;\n readonly store: FixtureDebugStore;\n readonly stateStore: DebugWorkbenchStateStore;\n readonly consoleStore: ConsoleEventsStore | undefined;\n readonly onActiveEntryChange: (entryKey: string) => void;\n readonly onClose: (() => void) | undefined;\n readonly externalHeaderHost: HTMLElement | null | undefined;\n readonly contentVisible: boolean;\n readonly popOutHref?: string;\n readonly floatTopHeaders: boolean;\n}\n\ninterface DropTarget {\n readonly stackId: string;\n readonly zone: DebugDockZone;\n}\n\nclass DebugWorkbenchViewModel extends ViewModel({\n workbenchId: prop.const<string>(),\n entries: prop<readonly DebugWorkbenchEntry[]>(),\n activeEntryKey: prop<string>(),\n store: prop.const<FixtureDebugStore>(),\n stateStore: prop.const<DebugWorkbenchStateStore>(),\n consoleStore: prop.const<ConsoleEventsStore | undefined>(),\n onActiveEntryChange: prop.const<(entryKey: string) => void>(),\n onClose: prop.const<(() => void) | undefined>(),\n externalHeaderHost: prop<HTMLElement | null | undefined>(),\n contentVisible: prop<boolean>(),\n popOutHref: prop.const<string | undefined>(),\n floatTopHeaders: prop.const<boolean>(),\n}) {\n readonly allEntries;\n readonly layout;\n readonly draggedEntryKey = observableValue<string | undefined>(this, undefined);\n readonly dropTarget = observableValue<DropTarget | undefined>(this, undefined);\n private readonly entriesByKey = new Map<string, WorkbenchEntry>();\n private rootElement: HTMLDivElement | null = null;\n private toolbarElement: HTMLDivElement | null = null;\n private stopPointerDrag: (() => void) | undefined;\n private suppressClickEntryKey: string | undefined;\n\n constructor(props: {\n readonly workbenchId: string;\n readonly entries: IObservable<readonly DebugWorkbenchEntry[]>;\n readonly activeEntryKey: IObservable<string>;\n readonly store: FixtureDebugStore;\n readonly stateStore: DebugWorkbenchStateStore;\n readonly consoleStore: ConsoleEventsStore | undefined;\n readonly onActiveEntryChange: (entryKey: string) => void;\n readonly onClose: (() => void) | undefined;\n readonly externalHeaderHost: IObservable<HTMLElement | null | undefined>;\n readonly contentVisible: IObservable<boolean>;\n readonly popOutHref: string | undefined;\n readonly floatTopHeaders: boolean;\n }) {\n super(props);\n const initialEntries = this.reconcileEntries(this.withConsoleEntry(props.entries.get()));\n if (initialEntries.length === 0) {\n throw new Error('DebugWorkbench requires at least one entry');\n }\n this.allEntries = observableValue<readonly WorkbenchEntry[]>(this, initialEntries);\n this.layout = props.stateStore.getLayout(\n props.workbenchId,\n initialEntries.map(entry => entry.key),\n props.activeEntryKey.get(),\n );\n this._store.add(autorun(reader => {\n const entries = this.reconcileEntries(this.withConsoleEntry(props.entries.read(reader)));\n if (entries.length === 0) {\n throw new Error('DebugWorkbench requires at least one entry');\n }\n const currentEntries = this.allEntries.get();\n if (\n entries.length !== currentEntries.length\n || entries.some((entry, index) => entry !== currentEntries[index])\n ) {\n this.allEntries.set(entries, undefined);\n }\n const entryKey = props.activeEntryKey.read(reader);\n const current = this.layout.get();\n const next = reconcileDebugWorkbenchLayout(\n current,\n entries.map(entry => entry.key),\n entryKey,\n );\n if (next !== current) this.layout.set(next, undefined);\n }));\n }\n\n getStackEntries(stack: DebugStackNode): readonly WorkbenchEntry[] {\n return stack.entryKeys\n .map(key => this.entriesByKey.get(key))\n .filter((entry): entry is WorkbenchEntry => entry !== undefined);\n }\n\n getEntry(entryKey: string): WorkbenchEntry | undefined {\n return this.entriesByKey.get(entryKey);\n }\n\n get store(): FixtureDebugStore { return this.props.store; }\n get consoleStore(): ConsoleEventsStore | undefined { return this.props.consoleStore; }\n get workbenchId(): string { return this.props.workbenchId; }\n get popOutHref(): string | undefined { return this.props.popOutHref; }\n get onClose(): (() => void) | undefined { return this.props.onClose; }\n get floatTopHeaders(): boolean { return this.props.floatTopHeaders; }\n get externalHeaderHost(): IObservable<HTMLElement | null | undefined> {\n return this.props.externalHeaderHost;\n }\n get contentVisible(): IObservable<boolean> { return this.props.contentVisible; }\n\n activate(entryKey: string): void {\n const current = this.layout.get();\n const next = activateDebugEntry(current, entryKey);\n if (next !== current) this.layout.set(next, undefined);\n this.props.onActiveEntryChange(entryKey);\n }\n\n open(entryKey: string, launcher: HTMLButtonElement): void {\n const origins = this.captureLauncherTabOrigins(launcher.parentElement);\n this.activate(entryKey);\n requestAnimationFrame(() => this.animateTabsFrom(origins));\n }\n\n finishTabDrag(): void {\n this.stopPointerDrag?.();\n this.stopPointerDrag = undefined;\n this.draggedEntryKey.set(undefined, undefined);\n this.dropTarget.set(undefined, undefined);\n }\n\n startTabPointerDrag(event: ReactPointerEvent<HTMLButtonElement>, entryKey: string): void {\n if (event.button !== 0) return;\n this.finishTabDrag();\n const source = event.currentTarget;\n const pointerId = event.pointerId;\n const startX = event.clientX;\n const startY = event.clientY;\n let dragging = false;\n const onMove = (pointerEvent: PointerEvent) => {\n if (!dragging && Math.hypot(pointerEvent.clientX - startX, pointerEvent.clientY - startY) < 4) {\n return;\n }\n dragging = true;\n pointerEvent.preventDefault();\n this.draggedEntryKey.set(entryKey, undefined);\n this.updatePointerDropTarget(pointerEvent.clientX, pointerEvent.clientY);\n };\n const onUp = (pointerEvent: PointerEvent) => {\n if (dragging) {\n pointerEvent.preventDefault();\n this.completePointerDrop(entryKey, pointerEvent.clientX, pointerEvent.clientY);\n this.suppressClickEntryKey = entryKey;\n setTimeout(() => {\n if (this.suppressClickEntryKey === entryKey) this.suppressClickEntryKey = undefined;\n }, 0);\n }\n this.finishTabDrag();\n };\n source.setPointerCapture(pointerId);\n source.addEventListener('pointermove', onMove);\n source.addEventListener('pointerup', onUp, { once: true });\n source.addEventListener('pointercancel', onUp, { once: true });\n this.stopPointerDrag = () => {\n source.removeEventListener('pointermove', onMove);\n source.removeEventListener('pointerup', onUp);\n source.removeEventListener('pointercancel', onUp);\n if (source.hasPointerCapture(pointerId)) source.releasePointerCapture(pointerId);\n };\n }\n\n consumeSuppressedClick(entryKey: string): boolean {\n if (this.suppressClickEntryKey !== entryKey) return false;\n this.suppressClickEntryKey = undefined;\n return true;\n }\n\n updatePaneDropTarget(stackId: string, zone: DebugDockZone): void {\n const current = this.dropTarget.get();\n if (current?.stackId === stackId && current.zone === zone) return;\n this.dropTarget.set({ stackId, zone }, undefined);\n }\n\n startSplitResize(\n event: ReactPointerEvent<HTMLDivElement>,\n split: DebugSplitNode,\n ): void {\n event.preventDefault();\n const container = event.currentTarget.parentElement;\n if (!container) return;\n const rect = container.getBoundingClientRect();\n const update = (pointerEvent: PointerEvent) => {\n const ratio = split.orientation === 'horizontal'\n ? (pointerEvent.clientX - rect.left) / rect.width\n : (pointerEvent.clientY - rect.top) / rect.height;\n this.layout.set(updateDebugSplitRatio(this.layout.get(), split.id, ratio), undefined);\n };\n const stop = () => {\n window.removeEventListener('pointermove', update);\n window.removeEventListener('pointerup', stop);\n window.removeEventListener('pointercancel', stop);\n };\n window.addEventListener('pointermove', update);\n window.addEventListener('pointerup', stop);\n window.addEventListener('pointercancel', stop);\n }\n\n setToolbarElement(element: HTMLDivElement | null): void {\n if (this.toolbarElement === element) return;\n this.toolbarElement = element;\n }\n\n setRootElement(element: HTMLDivElement | null): void {\n this.rootElement = element;\n }\n\n override dispose(): void {\n this.finishTabDrag();\n super.dispose();\n }\n\n private updatePointerDropTarget(clientX: number, clientY: number): void {\n const dockTarget = this.findDockTargetAt(clientX, clientY);\n if (dockTarget) {\n this.updatePaneDropTarget(\n dockTarget.dataset.debugStackId!,\n dockTarget.dataset.debugDockZone as DebugDockZone,\n );\n return;\n }\n const stack = this.findStackAt(clientX, clientY);\n if (!stack) {\n this.dropTarget.set(undefined, undefined);\n return;\n }\n this.updatePaneDropTarget(\n stack.dataset.debugStackId!,\n getDockZone(stack.getBoundingClientRect(), clientX, clientY),\n );\n }\n\n private completePointerDrop(entryKey: string, clientX: number, clientY: number): void {\n const targetTab = this.findTabAt(clientX, clientY);\n if (targetTab) {\n const targetEntryKey = targetTab.dataset.debugEntryKey;\n if (targetEntryKey && targetEntryKey !== entryKey) {\n const rect = targetTab.getBoundingClientRect();\n this.layout.set(reorderDebugEntry(\n this.layout.get(),\n entryKey,\n targetEntryKey,\n clientX < rect.left + rect.width / 2,\n ), undefined);\n }\n return;\n }\n const dockTarget = this.findDockTargetAt(clientX, clientY);\n const stack = this.findStackAt(clientX, clientY);\n const stackId = dockTarget?.dataset.debugStackId ?? stack?.dataset.debugStackId;\n const zone = dockTarget?.dataset.debugDockZone as DebugDockZone | undefined\n ?? (stackId === this.dropTarget.get()?.stackId ? this.dropTarget.get()?.zone : undefined)\n ?? (stack ? getDockZone(stack.getBoundingClientRect(), clientX, clientY) : 'center');\n if (!stackId) return;\n this.layout.set(dockDebugEntry(\n this.layout.get(),\n entryKey,\n stackId,\n zone,\n ), undefined);\n this.props.onActiveEntryChange(entryKey);\n }\n\n private findTabAt(clientX: number, clientY: number): HTMLButtonElement | undefined {\n return this.findElementAt<HTMLButtonElement>('.fixture-debug-toolbar-tab', clientX, clientY);\n }\n\n private findStackAt(clientX: number, clientY: number): HTMLDivElement | undefined {\n return this.findElementAt<HTMLDivElement>('.debug-workbench-stack', clientX, clientY);\n }\n\n private findDockTargetAt(clientX: number, clientY: number): HTMLDivElement | undefined {\n return this.findElementAt<HTMLDivElement>('.debug-workbench-dock-target', clientX, clientY)\n ?? this.findElementAt<HTMLDivElement>('.debug-workbench-drop-region', clientX, clientY);\n }\n\n private findElementAt<T extends HTMLElement>(\n selector: string,\n clientX: number,\n clientY: number,\n ): T | undefined {\n const root = (this.rootElement ?? this.toolbarElement)?.getRootNode();\n if (!(root instanceof Document || root instanceof ShadowRoot)) return undefined;\n return [...root.querySelectorAll<T>(selector)].find(element => {\n const owner = element.closest<HTMLElement>('[data-debug-workbench-id]');\n if (owner?.dataset.debugWorkbenchId !== this.props.workbenchId) return false;\n const rect = element.getBoundingClientRect();\n return clientX >= rect.left && clientX <= rect.right\n && clientY >= rect.top && clientY <= rect.bottom;\n });\n }\n\n private withConsoleEntry(entries: readonly DebugWorkbenchEntry[]): readonly WorkbenchEntry[] {\n return this.props.consoleStore\n ? [{ key: '$console', title: 'Console' }, ...entries]\n : entries;\n }\n\n private reconcileEntries(entries: readonly WorkbenchEntry[]): readonly WorkbenchEntry[] {\n const reconciled = entries.map(entry => {\n const current = this.entriesByKey.get(entry.key);\n return current && workbenchEntriesEqual(current, entry) ? current : entry;\n });\n this.entriesByKey.clear();\n for (const entry of reconciled) this.entriesByKey.set(entry.key, entry);\n return reconciled;\n }\n\n private captureLauncherTabOrigins(toolbar: HTMLElement | null): ReadonlyMap<string, DOMRect> {\n const result = new Map<string, DOMRect>();\n for (const tab of toolbar?.querySelectorAll<HTMLButtonElement>('[data-debug-entry-key]') ?? []) {\n const entryKey = tab.dataset.debugEntryKey;\n if (entryKey) result.set(entryKey, tab.getBoundingClientRect());\n }\n return result;\n }\n\n private animateTabsFrom(origins: ReadonlyMap<string, DOMRect>): void {\n for (const tab of this.rootElement?.querySelectorAll<HTMLButtonElement>('[data-debug-entry-key]') ?? []) {\n const origin = origins.get(tab.dataset.debugEntryKey ?? '');\n if (!origin) continue;\n const target = tab.getBoundingClientRect();\n tab.animate([\n {\n transform: `translate(${origin.left - target.left}px, ${origin.top - target.top}px)`,\n opacity: 0.6,\n },\n { transform: 'translate(0, 0)', opacity: 1 },\n ], {\n duration: 220,\n easing: 'cubic-bezier(0.2, 0, 0, 1)',\n });\n }\n }\n}\n\nfunction workbenchEntriesEqual(left: WorkbenchEntry, right: WorkbenchEntry): boolean {\n if (isConsoleEntry(left) || isConsoleEntry(right)) {\n return isConsoleEntry(left) && isConsoleEntry(right);\n }\n return left.key === right.key\n && left.title === right.title\n && left.fixtureId === right.fixtureId\n && left.fixtureName === right.fixtureName\n && left.panelId === right.panelId\n && left.definition === right.definition\n && left.outputEditable === right.outputEditable;\n}\n\nexport const DebugWorkbench = viewWithModel(\n DebugWorkbenchViewModel,\n (reader, model) => {\n const layout = model.layout.read(reader);\n model.allEntries.read(reader);\n const contentVisible = model.contentVisible.read(reader);\n const draggedEntryKey = model.draggedEntryKey.read(reader);\n const visibleEntryKeys = contentVisible\n ? getVisibleDebugEntryKeys(layout)\n : new Set<string>();\n const externalHeaderHost = model.externalHeaderHost.read(reader);\n const launcher = (\n <div\n ref={element => model.setToolbarElement(element)}\n role=\"toolbar\"\n aria-label=\"Fixture debug panels\"\n className=\"fixture-debug-toolbar-tabs\"\n data-debug-workbench-id={model.workbenchId}\n style={debugToolbarStyle}\n >\n {model.allEntries.read(reader).map(entry => (\n <button\n key={entry.key}\n type=\"button\"\n data-debug-entry-key={entry.key}\n className=\"fixture-debug-toolbar-tab\"\n style={debugTabStyle}\n onClick={event => model.open(entry.key, event.currentTarget)}\n title={`Show ${entry.title}`}\n >\n {entry.title}\n </button>\n ))}\n {model.popOutHref && <PopOutLink href={model.popOutHref} />}\n </div>\n );\n\n return (\n <div\n ref={element => model.setRootElement(element)}\n className=\"debug-workbench\"\n data-debug-workbench-id={model.workbenchId}\n style={debugWorkbenchStyle}\n >\n {!contentVisible && externalHeaderHost && createPortal(launcher, externalHeaderHost)}\n {contentVisible && (\n <div className=\"debug-workbench-layout\" style={layoutRootStyle}>\n {renderLayoutNode(\n model,\n layout,\n reader,\n model.floatTopHeaders,\n model.floatTopHeaders,\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nfunction renderLayoutNode(\n model: DebugWorkbenchViewModel,\n node: DebugWorkbenchNode,\n reader: IReader,\n topEdge: boolean,\n rightmostTopEdge: boolean,\n): ReactNode {\n if (node.type === 'stack') {\n return renderStack(model, node, reader, topEdge, rightmostTopEdge);\n }\n const horizontal = node.orientation === 'horizontal';\n const firstSize = `minmax(0, ${node.ratio}fr)`;\n const secondSize = `minmax(0, ${1 - node.ratio}fr)`;\n return (\n <div\n key={node.id}\n className={`debug-workbench-split debug-workbench-split-${node.orientation}`}\n style={{\n ...splitStyle,\n gridTemplateColumns: horizontal ? `${firstSize} 6px ${secondSize}` : 'minmax(0, 1fr)',\n gridTemplateRows: horizontal ? 'minmax(0, 1fr)' : `${firstSize} 6px ${secondSize}`,\n }}\n >\n {renderLayoutNode(\n model,\n node.first,\n reader,\n topEdge,\n horizontal ? false : rightmostTopEdge,\n )}\n <div\n role=\"separator\"\n aria-orientation={horizontal ? 'vertical' : 'horizontal'}\n className=\"debug-workbench-splitter\"\n style={{\n ...splitterStyle,\n cursor: horizontal ? 'col-resize' : 'row-resize',\n borderLeft: horizontal ? '1px solid var(--component-explorer-panel-border)' : undefined,\n borderTop: horizontal ? undefined : '1px solid var(--component-explorer-panel-border)',\n }}\n onPointerDown={event => model.startSplitResize(event, node)}\n />\n {renderLayoutNode(\n model,\n node.second,\n reader,\n horizontal ? topEdge : false,\n horizontal ? rightmostTopEdge : false,\n )}\n </div>\n );\n}\n\nfunction renderStack(\n model: DebugWorkbenchViewModel,\n stack: DebugStackNode,\n reader: IReader,\n topEdge: boolean,\n rightmostTopEdge: boolean,\n): ReactNode {\n const entry = model.getEntry(stack.activeEntryKey);\n if (!entry) return null;\n const dropTarget = model.dropTarget.read(reader);\n const draggedEntryKey = model.draggedEntryKey.read(reader);\n const activeDropZone = dropTarget?.stackId === stack.id ? dropTarget.zone : undefined;\n const visibleEntryKeys = getVisibleDebugEntryKeys(model.layout.get());\n return (\n <div\n key={stack.id}\n className=\"debug-workbench-stack\"\n data-debug-stack-id={stack.id}\n data-drop-zone={activeDropZone}\n style={stackStyle}\n >\n {renderStackHeader(\n model,\n stack,\n visibleEntryKeys,\n draggedEntryKey,\n topEdge,\n rightmostTopEdge,\n )}\n <div style={stackContentStyle}>\n <DebugPanelSurface\n key={`${stack.id}:${entry.key}`}\n entry={entry}\n store={model.store}\n consoleStore={model.consoleStore}\n />\n </div>\n {draggedEntryKey && activeDropZone && renderDockOverlay(stack.id, activeDropZone)}\n </div>\n );\n}\n\nfunction renderStackHeader(\n model: DebugWorkbenchViewModel,\n stack: DebugStackNode,\n visibleEntryKeys: ReadonlySet<string>,\n draggedEntryKey: string | undefined,\n topEdge: boolean,\n rightmostTopEdge: boolean,\n): ReactNode {\n return (\n <div\n key={stack.id}\n role=\"toolbar\"\n aria-label=\"Fixture debug panels\"\n className=\"fixture-debug-toolbar-tabs\"\n style={topEdge ? topEdgeStackHeaderStyle : localStackHeaderStyle}\n >\n {model.getStackEntries(stack).map(entry => (\n <button\n key={entry.key}\n type=\"button\"\n data-debug-entry-key={entry.key}\n aria-pressed={visibleEntryKeys.has(entry.key)}\n className=\"fixture-debug-toolbar-tab\"\n data-visible={visibleEntryKeys.has(entry.key) ? 'true' : undefined}\n style={{\n ...debugTabStyle,\n ...(visibleEntryKeys.has(entry.key) ? visibleDebugTabStyle : undefined),\n ...(draggedEntryKey === entry.key ? draggingDebugTabStyle : undefined),\n }}\n onClick={() => {\n if (!model.consumeSuppressedClick(entry.key)) model.activate(entry.key);\n }}\n onPointerDown={event => model.startTabPointerDrag(event, entry.key)}\n title={`Show ${entry.title}`}\n >\n {entry.title}\n </button>\n ))}\n {rightmostTopEdge && (model.popOutHref || model.onClose) && (\n <div style={headerActionsStyle}>\n {model.popOutHref && <PopOutLink href={model.popOutHref} />}\n {model.onClose && <CloseButton onClick={model.onClose} />}\n </div>\n )}\n </div>\n );\n}\n\nfunction PopOutLink({ href }: { readonly href: string }): ReactNode {\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title=\"Open in embedded mode\"\n aria-label=\"Open in embedded mode\"\n className=\"debug-workbench-header-action\"\n style={headerActionStyle}\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M1.5 1H6v1H2v12h12v-4h1v4.5l-.5.5h-13l-.5-.5v-13l.5-.5zm8 0H15v5.5l-1-1V3.707L8.357 9.354l-.707-.708L13.293 3H10.5l-1-1z\" />\n </svg>\n </a>\n );\n}\n\nfunction CloseButton({ onClick }: { readonly onClick: () => void }): ReactNode {\n return (\n <button\n type=\"button\"\n title=\"Close debug panels\"\n aria-label=\"Close debug panels\"\n className=\"debug-workbench-header-action\"\n style={headerActionButtonStyle}\n onClick={onClick}\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n <path\n d=\"M4 4l8 8m0-8l-8 8\"\n stroke=\"currentColor\"\n strokeWidth=\"1.4\"\n strokeLinecap=\"round\"\n />\n </svg>\n </button>\n );\n}\n\nfunction renderDockOverlay(stackId: string, activeZone: DebugDockZone): ReactNode {\n const zones: readonly DebugDockZone[] = ['top', 'left', 'center', 'right', 'bottom'];\n return (\n <>\n <div\n data-debug-stack-id={stackId}\n data-debug-dock-zone={activeZone}\n className={`debug-workbench-drop-preview debug-workbench-drop-region debug-workbench-drop-preview-${activeZone}`}\n style={{ ...dropPreviewStyle, ...getDropPreviewPosition(activeZone) }}\n >\n <span style={dropPreviewLabelStyle}>\n {activeZone === 'center' ? 'Add to this pane' : `Dock ${activeZone}`}\n </span>\n </div>\n <div className=\"debug-workbench-dock-overlay\" style={dockOverlayStyle}>\n {zones.map(zone => (\n <div\n key={zone}\n data-debug-stack-id={stackId}\n data-debug-dock-zone={zone}\n className=\"debug-workbench-dock-target\"\n style={{\n ...dockTargetStyle,\n ...getDockTargetPosition(zone),\n ...(activeZone === zone ? activeDockTargetStyle : undefined),\n }}\n title={zone === 'center' ? 'Add to pane' : `Dock ${zone}`}\n >\n {getDockTargetGlyph(zone)}\n </div>\n ))}\n </div>\n </>\n );\n}\n\ninterface DebugPanelSurfaceProps {\n readonly entry: WorkbenchEntry;\n readonly store: FixtureDebugStore;\n readonly consoleStore: ConsoleEventsStore | undefined;\n}\n\nclass DebugPanelSurfaceViewModel extends ViewModel({\n entry: prop.const<WorkbenchEntry>(),\n store: prop.const<FixtureDebugStore>(),\n consoleStore: prop.const<ConsoleEventsStore | undefined>(),\n}) {\n private host: HTMLDivElement | null = null;\n private panelDisposable: IDisposable | undefined;\n private lightDomTarget: LightDomPanelRenderTarget | undefined;\n private debugInfo: FixtureDebugInfo | undefined;\n\n constructor(props: DebugPanelSurfaceProps) {\n super(props);\n const entry = props.entry;\n if (!isConsoleEntry(entry)) {\n this._store.add(autorun(reader => {\n const info = props.store.read(reader, entry.fixtureId);\n const readyInfo = info?.ready ? info : undefined;\n if (readyInfo === this.debugInfo) return;\n this.debugInfo = readyInfo;\n this.mountPanel();\n }));\n }\n }\n\n setHost(host: HTMLDivElement | null): void {\n if (this.host === host) return;\n this.disposePanel();\n this.host = host;\n if (!host) return;\n\n this.lightDomTarget = createLightDomPanelRenderTarget(host, this.props.entry.key);\n this.mountPanel();\n }\n\n override dispose(): void {\n this.disposePanel();\n super.dispose();\n }\n\n private disposePanel(): void {\n disposeResource(this.panelDisposable);\n this.panelDisposable = undefined;\n this.lightDomTarget?.dispose();\n this.lightDomTarget = undefined;\n }\n\n private mountPanel(): void {\n disposeResource(this.panelDisposable);\n this.panelDisposable = undefined;\n const container = this.lightDomTarget?.renderContainer;\n if (!container) return;\n container.replaceChildren();\n\n const entry = this.props.entry;\n if (isConsoleEntry(entry)) {\n const store = this.props.consoleStore;\n if (!store) throw new Error('Console panel requires a console store');\n const root = createRoot(container);\n root.render(<ConsolePanel store={store} />);\n this.panelDisposable = { dispose: () => root.unmount() };\n return;\n }\n if (!this.debugInfo) return;\n this.panelDisposable = entry.panelId === OUTPUT_DEBUG_PANEL_ID\n ? mountOutputJsonPanel(container, this.debugInfo, entry.outputEditable === true)\n : mountCustomDebugPanel(container, entry, this.debugInfo);\n }\n}\n\nconst DebugPanelSurface = viewWithModel(\n DebugPanelSurfaceViewModel,\n (_reader, model) => (\n <div\n ref={element => model.setHost(element)}\n className=\"debug-panel-surface\"\n style={panelSurfaceStyle}\n />\n ),\n);\n\nfunction isConsoleEntry(entry: WorkbenchEntry): entry is ConsoleWorkbenchEntry {\n return entry.key === '$console';\n}\n\ninterface LightDomPanelRenderTarget {\n readonly renderContainer: HTMLDivElement;\n dispose(): void;\n}\n\nfunction createLightDomPanelRenderTarget(\n surface: HTMLDivElement,\n entryKey: string,\n): LightDomPanelRenderTarget {\n const rootNode = surface.getRootNode();\n const explorerHost = rootNode instanceof ShadowRoot ? rootNode.host : surface;\n const slotName = `debug-panel-${entryKey.replace(/[^a-zA-Z0-9_-]/g, '-')}-${Date.now()}`;\n const slot = document.createElement('slot');\n slot.name = slotName;\n slot.style.display = 'contents';\n surface.append(slot);\n\n const renderContainer = document.createElement('div');\n renderContainer.slot = slotName;\n renderContainer.className = 'component-explorer-debug-panel-content';\n Object.assign(renderContainer.style, {\n width: '100%',\n height: '100%',\n minWidth: '0',\n minHeight: '0',\n overflow: 'hidden',\n color: 'var(--vscode-foreground)',\n background: 'var(--vscode-editor-background)',\n });\n explorerHost.append(renderContainer);\n\n return {\n renderContainer,\n dispose: () => {\n slot.remove();\n renderContainer.remove();\n },\n };\n}\n\nfunction mountCustomDebugPanel(\n container: HTMLElement,\n entry: DebugWorkbenchEntry,\n info: FixtureDebugInfo,\n): IDisposable {\n const definition = entry.definition;\n if (!definition) {\n throw new Error(`Debug panel entry \"${entry.key}\" has no definition`);\n }\n let session: ReturnType<FixtureDebugInfo['rendering']['activateDebugPanel']> | undefined;\n const view = definition._render(container, action => session?.sendAction(action));\n try {\n session = info.rendering.activateDebugPanel(entry.panelId, state => view.update(state));\n } catch (error) {\n disposeResource(view);\n throw error;\n }\n return {\n dispose: () => {\n session?.dispose();\n return view.dispose();\n },\n };\n}\n\nfunction mountOutputJsonPanel(\n container: HTMLElement,\n info: FixtureDebugInfo,\n editable: boolean,\n): IDisposable {\n const root = createRoot(container);\n root.render(<OutputJsonPanel rendering={info.rendering} editable={editable} />);\n return { dispose: () => root.unmount() };\n}\n\nclass OutputJsonPanelViewModel extends ViewModel({\n rendering: prop.const<FixtureDebugInfo['rendering']>(),\n editable: prop.const<boolean>(),\n}) {\n readonly text = observableValue(this, '');\n readonly error = observableValue<string | undefined>(this, undefined);\n private readonly session;\n\n constructor(props: {\n readonly rendering: FixtureDebugInfo['rendering'];\n readonly editable: boolean;\n }) {\n super(props);\n this.session = props.rendering.activateDebugPanel(OUTPUT_DEBUG_PANEL_ID, output => {\n this.text.set(JSON.stringify(output, undefined, 2) ?? 'undefined', undefined);\n this.error.set(undefined, undefined);\n });\n }\n\n commit(): void {\n if (!this.props.editable) return;\n try {\n const value = JSON.parse(this.text.get()) as unknown;\n this.session.sendAction(value);\n this.error.set(undefined, undefined);\n } catch (error) {\n this.error.set(error instanceof Error ? error.message : String(error), undefined);\n }\n }\n\n get editable(): boolean { return this.props.editable; }\n\n override dispose(): void {\n this.session.dispose();\n super.dispose();\n }\n}\n\nconst OutputJsonPanel = viewWithModel(\n OutputJsonPanelViewModel,\n (reader, model) => {\n const text = model.text.read(reader);\n const error = model.error.read(reader);\n return (\n <div style={outputJsonContainerStyle}>\n <textarea\n value={text}\n readOnly={!model.editable}\n spellCheck={false}\n aria-label=\"Fixture output JSON\"\n style={outputJsonTextareaStyle}\n onChange={event => model.text.set(event.currentTarget.value, undefined)}\n onBlur={() => model.commit()}\n onKeyDown={event => {\n if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') model.commit();\n }}\n />\n {error && <div style={outputJsonErrorStyle}>{error}</div>}\n </div>\n );\n },\n);\n\nfunction getDropPreviewPosition(zone: DebugDockZone): CSSProperties {\n switch (zone) {\n case 'left': return { inset: '4px 50% 4px 4px' };\n case 'right': return { inset: '4px 4px 4px 50%' };\n case 'top': return { inset: '4px 4px 50% 4px' };\n case 'bottom': return { inset: '50% 4px 4px 4px' };\n case 'center': return { inset: '18%' };\n }\n}\n\nfunction getDockZone(rect: DOMRect, clientX: number, clientY: number): DebugDockZone {\n const x = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));\n const y = Math.max(0, Math.min(1, (clientY - rect.top) / rect.height));\n const edge = 0.25;\n const candidates: { readonly zone: DebugDockZone; readonly distance: number }[] = [];\n if (x < edge) candidates.push({ zone: 'left', distance: x });\n if (x > 1 - edge) candidates.push({ zone: 'right', distance: 1 - x });\n if (y < edge) candidates.push({ zone: 'top', distance: y });\n if (y > 1 - edge) candidates.push({ zone: 'bottom', distance: 1 - y });\n candidates.sort((a, b) => a.distance - b.distance);\n return candidates[0]?.zone ?? 'center';\n}\n\nfunction getDockTargetPosition(zone: DebugDockZone): CSSProperties {\n switch (zone) {\n case 'top': return { left: '36px', top: 0 };\n case 'left': return { left: 0, top: '36px' };\n case 'center': return { left: '36px', top: '36px' };\n case 'right': return { left: '72px', top: '36px' };\n case 'bottom': return { left: '36px', top: '72px' };\n }\n}\n\nfunction getDockTargetGlyph(zone: DebugDockZone): ReactNode {\n return (\n <span\n style={{\n width: '15px',\n height: '15px',\n border: '1px solid currentColor',\n borderRadius: '2px',\n background: getDockTargetGlyphBackground(zone),\n }}\n />\n );\n}\n\nfunction getDockTargetGlyphBackground(zone: DebugDockZone): string {\n const color = 'color-mix(in srgb, var(--component-explorer-focusBorder) 55%, transparent)';\n switch (zone) {\n case 'top': return `linear-gradient(to bottom, ${color} 50%, transparent 50%)`;\n case 'left': return `linear-gradient(to right, ${color} 50%, transparent 50%)`;\n case 'center': return color;\n case 'right': return `linear-gradient(to left, ${color} 50%, transparent 50%)`;\n case 'bottom': return `linear-gradient(to top, ${color} 50%, transparent 50%)`;\n }\n}\n\nfunction disposeResource(resource: IDisposable | undefined): void {\n const result = resource?.dispose();\n if (result instanceof Promise) {\n result.catch(error => console.error('Failed to dispose debug panel', error));\n }\n}\n\nconst debugWorkbenchStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n minWidth: 0,\n minHeight: 0,\n overflow: 'visible',\n background: 'transparent',\n};\n\nconst debugToolbarStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: '4px',\n minWidth: 0,\n};\n\nconst debugTabStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n height: '24px',\n maxWidth: '160px',\n padding: '0 10px',\n overflow: 'hidden',\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: 'var(--component-explorer-input-border, var(--component-explorer-widget-border))',\n borderRadius: '3px',\n color: 'var(--component-explorer-foreground)',\n backgroundColor: 'var(--component-explorer-input-background)',\n font: 'inherit',\n fontSize: '11px',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n cursor: 'grab',\n touchAction: 'none',\n userSelect: 'none',\n};\n\nconst visibleDebugTabStyle: CSSProperties = {\n color: 'var(--component-explorer-button-foreground)',\n borderColor: 'var(--component-explorer-button-background)',\n backgroundColor: 'var(--component-explorer-button-background)',\n};\n\nconst draggingDebugTabStyle: CSSProperties = {\n opacity: 0.6,\n cursor: 'grabbing',\n};\n\nconst layoutRootStyle: CSSProperties = {\n flex: 1,\n minWidth: 0,\n minHeight: 0,\n overflow: 'visible',\n};\n\nconst localStackHeaderStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: '4px',\n flex: '0 0 33px',\n minWidth: 0,\n padding: '4px',\n boxSizing: 'border-box',\n overflowX: 'auto',\n overflowY: 'hidden',\n borderBottom: '1px solid var(--component-explorer-panel-border)',\n background: 'var(--component-explorer-sideBar-background)',\n};\n\nconst topEdgeStackHeaderStyle: CSSProperties = {\n position: 'absolute',\n zIndex: 5,\n top: '-34px',\n left: 0,\n right: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: '4px',\n height: '24px',\n minWidth: 0,\n};\n\nconst splitStyle: CSSProperties = {\n display: 'grid',\n width: '100%',\n height: '100%',\n minWidth: 0,\n minHeight: 0,\n};\n\nconst splitterStyle: CSSProperties = {\n position: 'relative',\n zIndex: 3,\n background: 'transparent',\n touchAction: 'none',\n};\n\nconst stackStyle: CSSProperties = {\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n minWidth: 0,\n minHeight: 0,\n overflow: 'visible',\n border: '1px solid var(--component-explorer-panel-border)',\n borderRadius: '8px',\n background: 'var(--component-explorer-editor-background)',\n};\n\nconst stackContentStyle: CSSProperties = {\n flex: 1,\n minWidth: 0,\n minHeight: 0,\n overflow: 'hidden',\n borderRadius: '7px',\n};\n\nconst headerActionsStyle: CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n flex: '0 0 auto',\n gap: '2px',\n marginLeft: '2px',\n};\n\nconst headerActionStyle: CSSProperties = {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flex: '0 0 auto',\n width: '24px',\n height: '24px',\n boxSizing: 'border-box',\n border: 0,\n borderRadius: '3px',\n color: 'var(--component-explorer-descriptionForeground)',\n background: 'transparent',\n textDecoration: 'none',\n opacity: 0.75,\n transition: 'opacity 100ms ease, background-color 100ms ease',\n};\n\nconst headerActionButtonStyle: CSSProperties = {\n ...headerActionStyle,\n padding: 0,\n font: 'inherit',\n cursor: 'pointer',\n};\n\nconst panelSurfaceStyle: CSSProperties = {\n width: '100%',\n height: '100%',\n minWidth: 0,\n minHeight: 0,\n overflow: 'hidden',\n};\n\nconst dropPreviewStyle: CSSProperties = {\n position: 'absolute',\n zIndex: 10,\n display: 'grid',\n placeItems: 'center',\n pointerEvents: 'none',\n boxSizing: 'border-box',\n borderWidth: '2px',\n borderStyle: 'solid',\n borderColor: 'var(--component-explorer-focusBorder)',\n borderRadius: '7px',\n background: 'color-mix(in srgb, var(--component-explorer-focusBorder) 38%, transparent)',\n boxShadow: 'inset 0 0 0 1px color-mix(in srgb, white 25%, transparent), 0 0 16px color-mix(in srgb, var(--component-explorer-focusBorder) 30%, transparent)',\n transition: 'inset 150ms cubic-bezier(0.2, 0, 0, 1), border-radius 150ms ease',\n};\n\nconst dropPreviewLabelStyle: CSSProperties = {\n padding: '4px 8px',\n borderRadius: '5px',\n color: 'var(--component-explorer-foreground)',\n background: 'color-mix(in srgb, var(--component-explorer-editor-background) 92%, transparent)',\n boxShadow: '0 1px 5px rgb(0 0 0 / 35%)',\n fontSize: '11px',\n fontWeight: 600,\n};\n\nconst dockOverlayStyle: CSSProperties = {\n position: 'absolute',\n zIndex: 11,\n left: '50%',\n top: '50%',\n width: '104px',\n height: '104px',\n transform: 'translate(-50%, -50%)',\n pointerEvents: 'none',\n filter: 'drop-shadow(0 3px 8px rgb(0 0 0 / 35%))',\n};\n\nconst dockTargetStyle: CSSProperties = {\n position: 'absolute',\n display: 'grid',\n placeItems: 'center',\n width: '32px',\n height: '32px',\n boxSizing: 'border-box',\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: 'var(--component-explorer-panel-border)',\n borderRadius: '5px',\n color: 'var(--component-explorer-foreground)',\n background: 'var(--component-explorer-editor-background)',\n pointerEvents: 'auto',\n transition: 'background-color 100ms ease, border-color 100ms ease, transform 100ms ease',\n};\n\nconst activeDockTargetStyle: CSSProperties = {\n borderColor: 'var(--component-explorer-focusBorder)',\n background: 'color-mix(in srgb, var(--component-explorer-focusBorder) 20%, var(--component-explorer-editor-background))',\n transform: 'scale(1.08)',\n};\n\nconst outputJsonContainerStyle: CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n color: 'var(--vscode-editor-foreground)',\n background: 'var(--vscode-editor-background)',\n};\n\nconst outputJsonTextareaStyle: CSSProperties = {\n flex: 1,\n minWidth: 0,\n minHeight: 0,\n resize: 'none',\n border: 0,\n outline: 0,\n padding: '10px',\n color: 'inherit',\n background: 'inherit',\n fontFamily: 'var(--vscode-editor-font-family)',\n fontSize: 'var(--vscode-editor-font-size)',\n};\n\nconst outputJsonErrorStyle: CSSProperties = {\n padding: '4px 10px',\n color: 'var(--vscode-errorForeground)',\n borderTop: '1px solid var(--vscode-panel-border)',\n};\n","import type { DebugPanelPlacement } from '../core/index.js';\n\nexport function resolveDebugPanelPlacement(\n explicitPlacement: DebugPanelPlacement | undefined,\n logicalFixtureCount: number,\n): DebugPanelPlacement {\n return explicitPlacement\n ?? (logicalFixtureCount === 1 ? 'canvas-right' : 'bottom-panel');\n}\n","import * as React from 'react';\nimport { observableValue, autorun, type IDisposable, type IReader } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport { buildExplorerUrl } from '@vscode/component-explorer-common';\nimport { resolveViewport } from '../core/index.js';\nimport { ComponentRendering } from '../core/ComponentRenderer.js';\nimport type { FixtureInputStore } from '../core/index.js';\nimport type { ExceptionError } from '../core/ErrorInfo.js';\nimport type { FixtureItem } from './ExplorerModel.js';\nimport { buildQueryParamUrl } from '../lib/queryParamObservable.js';\nimport { getExplorerShadowHost } from '../lib/explorerShadowHost.js';\nimport { registerFixtureContainer } from '../lib/fixtureFocusTrap.js';\nimport {\n calculatePagePreviewGeometry,\n type FixtureViewportStore,\n type PagePreviewGeometry,\n type PagePreviewMode,\n type PageViewportSettings,\n} from './PageViewportState.js';\nimport type { FixtureDebugStore } from './FixtureDebugStore.js';\nimport { DebugWorkbench, type DebugWorkbenchEntry } from './DebugWorkbench.js';\nimport type { DebugWorkbenchStateStore } from './DebugWorkbenchState.js';\nimport { resolveDebugPanelPlacement } from './DebugPanelPlacement.js';\nimport { OUTPUT_DEBUG_PANEL_ID } from '../core/FixtureInteractionRuntime.js';\n\nfunction buildEmbeddedUrl(fixtureId: string): string {\n return buildExplorerUrl({\n pathname: location.pathname,\n baseQuery: location.search,\n mode: 'embedded',\n fixtureId,\n });\n}\n\nlet _nextSlotId = 0;\n\nclass FixturePreviewItemModel extends ViewModel({\n fixture: prop.const<FixtureItem>(),\n compact: prop.const<boolean | undefined>(),\n onSelect: prop.const<((nodeId: string) => void) | undefined>(),\n inputStore: prop.const<FixtureInputStore | undefined>(),\n viewportStore: prop.const<FixtureViewportStore>(),\n availablePageHeight: prop<number>(),\n debugStore: prop.const<FixtureDebugStore>(),\n debugWorkbenchState: prop.const<DebugWorkbenchStateStore>(),\n logicalFixtureCount: prop.const<number>(),\n}) {\n private _canvasRef: HTMLDivElement | null = null;\n private _fixtureContainer: HTMLDivElement | null = null;\n private _rendering: ComponentRendering | null = null;\n private _resizeObserver: ResizeObserver | null = null;\n private _pageHostResizeObserver: ResizeObserver | null = null;\n private _pageHostRef: HTMLDivElement | null = null;\n private _contentHostRef: HTMLDivElement | null = null;\n private _contentHostResizeObserver: ResizeObserver | null = null;\n private _fixtureColumnRef: HTMLDivElement | null = null;\n private _fixtureColumnResizeObserver: ResizeObserver | null = null;\n private _debugHeaderHostRef: HTMLDivElement | null = null;\n private _stopDebugPaneResize: (() => void) | undefined;\n private _mountSub: IDisposable | null = null;\n\n readonly measuredWidth = observableValue<number | undefined>(this, undefined);\n readonly measuredHeight = observableValue<number | undefined>(this, undefined);\n readonly availableWidth = observableValue(this, 0);\n readonly reservedHeight = observableValue(this, 0);\n readonly contentHostWidth = observableValue(this, 0);\n readonly fixtureColumnHeight = observableValue(this, 0);\n readonly debugHeaderHost = observableValue<HTMLElement | null>(this, null);\n readonly debugPaneFraction = observableValue(this, 0.4);\n readonly error = observableValue<ExceptionError | undefined>(this, undefined);\n readonly slotName = `fixture-${_nextSlotId++}`;\n\n get fixture(): FixtureItem { return this.props.fixture; }\n get compact(): boolean { return this.props.compact ?? false; }\n get onSelect(): ((nodeId: string) => void) | undefined { return this.props.onSelect; }\n get viewportStore(): FixtureViewportStore { return this.props.viewportStore; }\n get availablePageHeight() { return this.props.availablePageHeight; }\n get debugStore(): FixtureDebugStore { return this.props.debugStore; }\n get debugWorkbenchState(): DebugWorkbenchStateStore { return this.props.debugWorkbenchState; }\n get logicalFixtureCount(): number { return this.props.logicalFixtureCount; }\n get inputStore(): FixtureInputStore | undefined { return this.props.inputStore; }\n\n setContentHostRef = (el: HTMLDivElement | null): void => {\n this._contentHostResizeObserver?.disconnect();\n this._contentHostResizeObserver = null;\n this._contentHostRef = el;\n if (!el) return;\n this._contentHostResizeObserver = new ResizeObserver(() => {\n this.contentHostWidth.set(el.clientWidth, undefined);\n });\n this._contentHostResizeObserver.observe(el);\n this.contentHostWidth.set(el.clientWidth, undefined);\n };\n\n setFixtureColumnRef = (el: HTMLDivElement | null): void => {\n this._fixtureColumnResizeObserver?.disconnect();\n this._fixtureColumnResizeObserver = null;\n this._fixtureColumnRef = el;\n if (!el) {\n this.fixtureColumnHeight.set(0, undefined);\n return;\n }\n const measure = (): void => {\n this.fixtureColumnHeight.set(Math.ceil(el.getBoundingClientRect().height), undefined);\n };\n this._fixtureColumnResizeObserver = new ResizeObserver(measure);\n this._fixtureColumnResizeObserver.observe(el);\n measure();\n };\n\n selectDebugEntry = (entryKey: string): void => {\n const activeEntry = this.debugWorkbenchState.getActiveEntry(`inline:${this.fixture.id}`);\n activeEntry.set(entryKey, undefined);\n };\n\n closeDebugPane = (): void => {\n this.debugWorkbenchState.getActiveEntry(`inline:${this.fixture.id}`).set(undefined, undefined);\n };\n\n setDebugHeaderHostRef = (el: HTMLDivElement | null): void => {\n this._debugHeaderHostRef = el;\n this.debugHeaderHost.set(el, undefined);\n };\n\n beginDebugPaneResize(clientX: number): void {\n const host = this._contentHostRef;\n if (!host) return;\n this._stopDebugPaneResize?.();\n const onMove = (event: PointerEvent): void => {\n const rect = host.getBoundingClientRect();\n const splitterWidth = 8;\n const usableWidth = Math.max(1, rect.width - splitterWidth);\n const paneWidth = rect.right - event.clientX;\n const minPaneWidth = Math.min(280, usableWidth * 0.45);\n const minFixtureWidth = Math.min(320, usableWidth * 0.5);\n const maxPaneWidth = Math.max(minPaneWidth, usableWidth - minFixtureWidth);\n const clampedPaneWidth = Math.min(maxPaneWidth, Math.max(minPaneWidth, paneWidth));\n this.debugPaneFraction.set(clampedPaneWidth / usableWidth, undefined);\n };\n const stop = (): void => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', stop);\n window.removeEventListener('pointercancel', stop);\n document.documentElement.style.cursor = '';\n document.documentElement.style.userSelect = '';\n this._stopDebugPaneResize = undefined;\n };\n this._stopDebugPaneResize = stop;\n document.documentElement.style.cursor = 'col-resize';\n document.documentElement.style.userSelect = 'none';\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', stop);\n window.addEventListener('pointercancel', stop);\n onMove(new PointerEvent('pointermove', { clientX }));\n }\n\n setPageHostRef = (el: HTMLDivElement | null): void => {\n this._pageHostResizeObserver?.disconnect();\n this._pageHostResizeObserver = null;\n window.removeEventListener('resize', this._measurePageHost);\n this._pageHostRef = el;\n if (!el) return;\n\n this._pageHostResizeObserver = new ResizeObserver(this._measurePageHost);\n this._pageHostResizeObserver.observe(el);\n window.addEventListener('resize', this._measurePageHost);\n requestAnimationFrame(this._measurePageHost);\n };\n\n setCanvasRef = (el: HTMLDivElement | null): void => {\n if (el === this._canvasRef) return;\n\n this._cleanup();\n\n this._canvasRef = el;\n if (!el) return;\n\n // (Re)build the fixture whenever its input overrides change. A full rebuild (rather than\n // an in-place update) keeps this simple and avoids re-`attachShadow` on shadow-dom fixtures.\n this._mountSub = autorun((reader) => {\n const input = this.props.inputStore?.getInput(this.fixture.id, this.fixture.component.inputSchema).read(reader);\n if (this._rendering?.updateInput(input)) {\n return;\n }\n this._mount(input);\n });\n };\n\n private _mount(input: unknown): void {\n this._teardownRendering();\n\n const shadowHost = getExplorerShadowHost();\n\n const fixtureContainer = document.createElement('div');\n fixtureContainer.slot = this.slotName;\n\n const component = this.fixture.component;\n const displayMode = component.displayMode;\n if (displayMode.type === 'page') {\n fixtureContainer.style.width = '100%';\n fixtureContainer.style.height = '100%';\n fixtureContainer.style.boxSizing = 'border-box';\n fixtureContainer.style.overflow = 'auto';\n } else {\n fixtureContainer.style.all = 'initial';\n fixtureContainer.style.display = 'inline-block';\n }\n\n shadowHost.appendChild(fixtureContainer);\n this._fixtureContainer = fixtureContainer;\n registerFixtureContainer(fixtureContainer);\n\n const rendering = new ComponentRendering(\n fixtureContainer,\n component,\n { kind: 'explorer-ui', interactive: true },\n input,\n );\n this._rendering = rendering;\n this.debugStore.setRendering(this.fixture, rendering);\n if (displayMode.type === 'page') {\n rendering.renderTarget.style.width = '100%';\n rendering.renderTarget.style.height = '100%';\n rendering.renderTarget.style.boxSizing = 'border-box';\n }\n\n rendering.waitForRendering().then(() => {\n this.debugStore.markReady(this.fixture, rendering);\n }).catch((err) => {\n this.error.set(err as ExceptionError, undefined);\n });\n\n this._resizeObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const { width, height } = entry.contentRect;\n if (height > 0) {\n this.measuredWidth.set(Math.round(width), undefined);\n this.measuredHeight.set(Math.round(height), undefined);\n }\n }\n });\n this._resizeObserver.observe(rendering.renderTarget);\n }\n\n /** Tears down the live rendering + its DOM, leaving the autorun subscription intact. */\n private _teardownRendering(): void {\n // Fire-and-forget — UI dispose errors are not surfaced (no report consumer).\n const rendering = this._rendering;\n if (rendering) {\n this.debugStore.remove(this.fixture.id, rendering);\n rendering.dispose().catch(error => console.error('Failed to dispose fixture rendering', error));\n }\n this._rendering = null;\n this._resizeObserver?.disconnect();\n this._resizeObserver = null;\n this._fixtureContainer?.remove();\n this._fixtureContainer = null;\n this.error.set(undefined, undefined);\n }\n\n private _cleanup(): void {\n this._mountSub?.dispose();\n this._mountSub = null;\n this._teardownRendering();\n }\n\n private _measurePageHost = (): void => {\n const host = this._pageHostRef;\n const canvas = host?.firstElementChild;\n if (!host || !(canvas instanceof HTMLElement)) return;\n\n const canvasStyle = getComputedStyle(canvas);\n const horizontalPadding = Number.parseFloat(canvasStyle.paddingLeft)\n + Number.parseFloat(canvasStyle.paddingRight);\n this.availableWidth.set(\n Math.max(0, Math.floor(host.clientWidth - horizontalPadding)),\n undefined,\n );\n\n const row = host.closest<HTMLElement>('[data-row-id]');\n if (row) {\n const verticalPadding = Number.parseFloat(canvasStyle.paddingTop)\n + Number.parseFloat(canvasStyle.paddingBottom);\n const chromeHeight = host.getBoundingClientRect().top - row.getBoundingClientRect().top;\n this.reservedHeight.set(Math.max(0, Math.ceil(chromeHeight + verticalPadding)), undefined);\n }\n };\n\n dispose(): void {\n this._cleanup();\n this._pageHostResizeObserver?.disconnect();\n this._pageHostResizeObserver = null;\n window.removeEventListener('resize', this._measurePageHost);\n this._pageHostRef = null;\n this._contentHostResizeObserver?.disconnect();\n this._contentHostResizeObserver = null;\n this._contentHostRef = null;\n this._fixtureColumnResizeObserver?.disconnect();\n this._fixtureColumnResizeObserver = null;\n this._fixtureColumnRef = null;\n this._debugHeaderHostRef = null;\n this._stopDebugPaneResize?.();\n }\n}\n\nexport const FixturePreviewItem = viewWithModel(\n FixturePreviewItemModel,\n {},\n (reader, model) => {\n const fixture = model.fixture;\n const component = fixture.component;\n const measuredWidth = model.measuredWidth.read(reader);\n const measuredHeight = model.measuredHeight.read(reader);\n const error = model.error.read(reader);\n const compact = model.compact;\n const displayMode = component.displayMode;\n const pageSettings = displayMode.type === 'page'\n ? model.viewportStore.read(reader, fixture.id, displayMode)\n : undefined;\n const pageGeometry = pageSettings\n ? calculatePagePreviewGeometry(\n pageSettings,\n model.availableWidth.read(reader),\n Math.max(0, model.availablePageHeight.read(reader) - model.reservedHeight.read(reader)),\n )\n : undefined;\n\n const dimensionsText = measuredWidth && measuredHeight\n ? `${measuredWidth} × ${measuredHeight}`\n : '';\n\n const wrapperStyle = compact ? previewItemStyles.wrapperCompact : previewItemStyles.wrapper;\n const nameStyle = compact ? previewItemStyles.nameCompact : previewItemStyles.name;\n const debugInfo = model.debugStore.read(reader, fixture.id);\n const debugEntries = getInlineDebugEntries(\n fixture,\n model.logicalFixtureCount,\n debugInfo?.ready === true && debugInfo.hasOutput,\n debugInfo?.outputEditable === true,\n );\n const activeDebugEntryKey = model.debugWorkbenchState\n .getActiveEntry(`inline:${fixture.id}`)\n .read(reader);\n const debugPaneOpen = activeDebugEntryKey !== undefined;\n const contentHostWidth = model.contentHostWidth.read(reader);\n const fixtureColumnHeight = model.fixtureColumnHeight.read(reader);\n const usableDebugWidth = Math.max(0, contentHostWidth - 8);\n const debugPaneWidth = Math.round(usableDebugWidth * model.debugPaneFraction.read(reader));\n const collapsedFixtureWidth = pageGeometry && pageSettings\n ? pageSettings.mode === 'actual'\n ? pageGeometry.visualWidth + 24\n : undefined\n : measuredWidth !== undefined\n ? measuredWidth + 24\n : undefined;\n const fixtureColumnWidth = contentHostWidth > 0\n ? debugPaneOpen\n ? Math.max(0, contentHostWidth - 8 - debugPaneWidth)\n : collapsedFixtureWidth === undefined\n ? undefined\n : Math.min(contentHostWidth, collapsedFixtureWidth)\n : undefined;\n const fallbackDebugHeight = pageGeometry\n ? Math.max(280, pageGeometry.visualHeight + 24)\n : Math.max(280, measuredHeight ?? 0);\n const debugHeight = fixtureColumnHeight > 0 ? fixtureColumnHeight : fallbackDebugHeight;\n const tabPanelId = `${model.slotName}-debug-tabpanel`;\n\n return (\n <div style={wrapperStyle}>\n <div style={getLabelRowStyle(debugEntries.length > 0, debugPaneOpen, fixtureColumnWidth, contentHostWidth)}>\n {compact && (\n <a\n href={buildQueryParamUrl('fixture', fixture.id)}\n style={{ ...nameStyle, textDecoration: 'none', color: 'inherit' }}\n onClick={(e) => { if (model.onSelect) { e.preventDefault(); model.onSelect(fixture.id); } }}\n >{fixture.name}</a>\n )}\n {!compact && displayMode.type !== 'page' && dimensionsText && (\n <span style={previewItemStyles.dimensions}>{dimensionsText}</span>\n )}\n {displayMode.type === 'page' && pageSettings && pageGeometry && (\n <PageViewportControls\n fixtureId={fixture.id}\n pageMode={displayMode}\n settings={pageSettings}\n geometry={pageGeometry}\n store={model.viewportStore}\n />\n )}\n {renderToolbarInputControls(reader, model)}\n {debugEntries.length > 0 && (\n <div style={previewItemStyles.debugToolbarGroup}>\n <div\n ref={model.setDebugHeaderHostRef}\n className=\"component-explorer-debug-header-host\"\n style={previewItemStyles.debugHeaderHost}\n />\n </div>\n )}\n {debugEntries.length === 0 && (\n <a\n href={buildEmbeddedUrl(fixture.id)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title=\"Open in embedded mode\"\n style={previewItemStyles.embeddedLink}\n >\n <EmbeddedIcon />\n </a>\n )}\n </div>\n <div\n ref={debugEntries.length > 0 ? model.setContentHostRef : undefined}\n style={debugEntries.length > 0\n ? previewItemStyles.contentWithDebug\n : undefined}\n >\n <div\n style={debugEntries.length > 0\n ? getDebugContentStyle(debugPaneOpen, fixtureColumnWidth, debugPaneWidth)\n : undefined}\n >\n <div\n ref={debugEntries.length > 0 ? model.setFixtureColumnRef : undefined}\n style={debugEntries.length > 0 ? previewItemStyles.fixtureColumn : undefined}\n >\n {pageGeometry && pageSettings ? (\n <div ref={model.setPageHostRef} style={previewItemStyles.pageHost}>\n <div ref={model.setCanvasRef} style={getCanvasStyle(component.background, pageSettings.mode)}>\n <div style={getPageFrameStyle(pageGeometry, pageSettings.mode)}>\n <div style={getPageScaleLayerStyle(pageGeometry, pageSettings.mode)}>\n <slot name={model.slotName} />\n </div>\n </div>\n </div>\n </div>\n ) : (\n <div ref={model.setCanvasRef} style={getCanvasStyle(component.background, undefined)}>\n <slot name={model.slotName} />\n </div>\n )}\n {error && <FixtureError error={error} />}\n </div>\n {debugEntries.length > 0 && (\n <>\n {debugPaneOpen && (\n <div\n role=\"separator\"\n aria-label=\"Resize fixture and debug panes\"\n aria-orientation=\"vertical\"\n style={{ ...previewItemStyles.debugSplitter, height: debugHeight }}\n onPointerDown={event => {\n event.preventDefault();\n model.beginDebugPaneResize(event.clientX);\n }}\n />\n )}\n <div\n id={tabPanelId}\n role=\"region\"\n aria-label={`${fixture.name} debug panels`}\n className=\"component-explorer-inline-debug-pane\"\n style={{\n ...previewItemStyles.inlineDebug,\n height: debugHeight,\n display: debugPaneOpen ? 'block' : 'none',\n }}\n >\n <DebugWorkbench\n workbenchId={`inline:${fixture.id}`}\n entries={debugEntries}\n activeEntryKey={activeDebugEntryKey ?? debugEntries[0].key}\n externalHeaderHost={model.debugHeaderHost.read(reader)}\n contentVisible={debugPaneOpen}\n onActiveEntryChange={model.selectDebugEntry}\n onClose={model.closeDebugPane}\n store={model.debugStore}\n stateStore={model.debugWorkbenchState}\n consoleStore={undefined}\n popOutHref={buildEmbeddedUrl(fixture.id)}\n floatTopHeaders\n />\n </div>\n </>\n )}\n </div>\n </div>\n </div>\n );\n\n function getInlineDebugEntries(\n fixture: FixtureItem,\n logicalFixtureCount: number,\n hasOutput: boolean,\n outputEditable: boolean,\n ): readonly DebugWorkbenchEntry[] {\n const entries: DebugWorkbenchEntry[] = fixture.component.debugPanels\n .filter(panel => resolveDebugPanelPlacement(panel.placement, logicalFixtureCount) === 'canvas-right')\n .map(panel => ({\n key: `${fixture.id}:${panel.id}`,\n fixtureId: fixture.id,\n fixtureName: fixture.name,\n panelId: panel.id,\n title: panel.title,\n definition: panel,\n }));\n if (hasOutput && logicalFixtureCount === 1) {\n entries.push({\n key: `${fixture.id}:${OUTPUT_DEBUG_PANEL_ID}`,\n fixtureId: fixture.id,\n fixtureName: fixture.name,\n panelId: OUTPUT_DEBUG_PANEL_ID,\n title: 'Output',\n outputEditable,\n });\n }\n return entries;\n }\n\n function renderToolbarInputControls(\n reader: IReader,\n model: FixturePreviewItemModel,\n ): React.ReactNode {\n const controls = model.fixture.component.inputControls;\n const schemaProperties = model.fixture.component.inputSchema?.properties;\n const store = model.inputStore;\n if (!controls || !schemaProperties || !store) return null;\n\n return Object.entries(controls).flatMap(([name, options]) => {\n if (options.placement !== 'toolbar' && options.placement !== 'both') return [];\n const schema = schemaProperties[name];\n if (!schema) return [];\n const value = store.readValue(reader, name, schema);\n const label = options.label ?? name;\n if (schema.type === 'boolean') {\n return [(\n <button\n key={name}\n type=\"button\"\n aria-pressed={value === true}\n title={options.title ?? label}\n style={{\n ...previewItemStyles.inputToggle,\n ...(value === true ? previewItemStyles.inputToggleActive : {}),\n }}\n onClick={() => store.setValue(name, schema, value !== true)}\n >\n {label}\n </button>\n )];\n }\n if (schema.enum && schema.enum.length > 0) {\n return [(\n <label key={name} style={previewItemStyles.inputSelectLabel} title={options.title}>\n <span>{label}</span>\n <select\n aria-label={label}\n style={previewItemStyles.modeSelect}\n value={String(value ?? '')}\n onChange={event => {\n const next = schema.enum!.find(option => String(option) === event.target.value);\n store.setValue(name, schema, next);\n }}\n >\n {schema.enum.map(option => (\n <option key={String(option)} value={String(option)}>{String(option)}</option>\n ))}\n </select>\n </label>\n )];\n }\n return [];\n });\n }\n\n }\n);\n\nfunction PageViewportControls({\n fixtureId,\n pageMode,\n settings,\n geometry,\n store,\n}: {\n readonly fixtureId: string;\n readonly pageMode: Extract<FixtureItem['component']['displayMode'], { type: 'page' }>;\n readonly settings: PageViewportSettings;\n readonly geometry: PagePreviewGeometry;\n readonly store: FixtureViewportStore;\n}): React.ReactElement {\n const selectedViewport = resolveViewport(pageMode.viewports[settings.viewportIndex] ?? 'desktop');\n const usesSelectedViewport = settings.width === selectedViewport.width\n && settings.height === selectedViewport.height;\n const selectedValue = usesSelectedViewport ? String(settings.viewportIndex) : 'custom';\n\n return (\n <div style={previewItemStyles.viewportControls}>\n <select\n aria-label=\"Viewport preset\"\n title=\"Viewport preset\"\n style={previewItemStyles.viewportSelect}\n value={selectedValue}\n onChange={(event) => {\n if (event.target.value !== 'custom') {\n store.selectViewport(fixtureId, pageMode, Number(event.target.value));\n }\n }}\n >\n {pageMode.viewports.map((viewport, index) => (\n <option key={`${resolveViewport(viewport).name}-${index}`} value={String(index)}>\n {resolveViewport(viewport).name}\n </option>\n ))}\n {!usesSelectedViewport && <option value=\"custom\">Custom</option>}\n </select>\n <DimensionInput\n label=\"Viewport width\"\n value={settings.mode === 'responsive' ? geometry.logicalWidth : settings.width}\n disabled={settings.mode === 'responsive'}\n onCommit={(value) => store.setWidth(fixtureId, pageMode, value)}\n />\n <span style={previewItemStyles.dimensionSeparator}>×</span>\n <DimensionInput\n label=\"Viewport height\"\n value={settings.mode === 'responsive' ? geometry.logicalHeight : settings.height}\n disabled={settings.mode === 'responsive'}\n onCommit={(value) => store.setHeight(fixtureId, pageMode, value)}\n />\n <select\n aria-label=\"Preview sizing mode\"\n title=\"Preview sizing mode\"\n style={previewItemStyles.modeSelect}\n value={settings.mode}\n onChange={(event) => store.setMode(fixtureId, pageMode, event.target.value as PagePreviewMode)}\n >\n <option value=\"fit\">Fit</option>\n <option value=\"responsive\">Responsive</option>\n <option value=\"actual\">1:1</option>\n </select>\n {settings.mode === 'fit' && geometry.scale < 1 && (\n <span style={previewItemStyles.scaleText}>{Math.round(geometry.scale * 100)}%</span>\n )}\n </div>\n );\n}\n\nfunction DimensionInput({\n label,\n value,\n disabled = false,\n onCommit,\n}: {\n readonly label: string;\n readonly value: number;\n readonly disabled?: boolean;\n readonly onCommit: (value: number) => void;\n}): React.ReactElement {\n const commit = (target: HTMLInputElement): void => {\n const parsed = Number(target.value);\n if (Number.isFinite(parsed)) {\n onCommit(parsed);\n } else {\n target.value = String(value);\n }\n };\n\n return (\n <input\n key={`${label}-${value}`}\n aria-label={label}\n title={disabled ? `${label} follows available preview width` : label}\n type=\"number\"\n min={1}\n max={10_000}\n defaultValue={String(value)}\n disabled={disabled}\n style={previewItemStyles.dimensionInput}\n onBlur={(event) => commit(event.currentTarget)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.currentTarget.blur();\n }\n }}\n />\n );\n}\n\n// Checkered pattern for transparency background (Figma-style)\nconst CHECKER_SIZE = 8;\n\nfunction createCheckerPattern(baseColor: string, checkerColor: string): string {\n return `\n linear-gradient(45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(-45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, ${checkerColor} 75%),\n linear-gradient(-45deg, transparent 75%, ${checkerColor} 75%)\n `;\n}\n\nconst lightPattern = {\n backgroundColor: '#ffffff',\n backgroundImage: createCheckerPattern('#ffffff', '#e5e5e5'),\n};\n\nconst darkPattern = {\n backgroundColor: '#1e1e1e',\n backgroundImage: createCheckerPattern('#1e1e1e', '#2d2d2d'),\n};\n\nconst canvasBaseStyle: React.CSSProperties = {\n display: 'inline-block',\n padding: '12px',\n borderRadius: '4px',\n backgroundSize: `${CHECKER_SIZE * 2}px ${CHECKER_SIZE * 2}px`,\n backgroundPosition: `0 0, 0 ${CHECKER_SIZE}px, ${CHECKER_SIZE}px -${CHECKER_SIZE}px, -${CHECKER_SIZE}px 0`,\n boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)',\n overflow: 'hidden',\n position: 'relative',\n};\n\nfunction getCanvasStyle(\n background: 'light' | 'dark',\n pageMode: PagePreviewMode | undefined,\n): React.CSSProperties {\n const pattern = background === 'dark' ? darkPattern : lightPattern;\n return {\n ...canvasBaseStyle,\n ...(pageMode ? {\n display: 'block',\n width: '100%',\n boxSizing: 'border-box',\n overflow: pageMode === 'actual' ? 'auto' : 'hidden',\n } : {}),\n backgroundColor: pattern.backgroundColor,\n backgroundImage: pattern.backgroundImage,\n };\n}\n\nfunction getPageFrameStyle(\n geometry: PagePreviewGeometry,\n mode: PagePreviewMode,\n): React.CSSProperties {\n return {\n position: 'relative',\n width: mode === 'responsive' ? '100%' : `${geometry.visualWidth}px`,\n height: `${geometry.visualHeight}px`,\n overflow: 'hidden',\n };\n}\n\nfunction getPageScaleLayerStyle(\n geometry: PagePreviewGeometry,\n mode: PagePreviewMode,\n): React.CSSProperties {\n return {\n width: mode === 'responsive' ? '100%' : `${geometry.logicalWidth}px`,\n height: `${geometry.logicalHeight}px`,\n transform: geometry.scale === 1 ? undefined : `scale(${geometry.scale})`,\n transformOrigin: 'top left',\n };\n}\n\nfunction getDebugContentStyle(\n debugPaneOpen: boolean,\n fixtureColumnWidth: number | undefined,\n debugPaneWidth: number,\n): React.CSSProperties {\n const fixtureTrack = fixtureColumnWidth === undefined\n ? 'minmax(0, 1fr)'\n : `${fixtureColumnWidth}px`;\n return {\n display: 'grid',\n alignItems: 'start',\n gridTemplateColumns: `${fixtureTrack} ${debugPaneOpen ? '8px' : '0px'} ${debugPaneOpen ? `${Math.max(0, debugPaneWidth)}px` : '0px'}`,\n width: '100%',\n minWidth: 0,\n };\n}\n\nfunction getLabelRowStyle(\n hasDebugEntries: boolean,\n debugPaneOpen: boolean,\n fixtureColumnWidth: number | undefined,\n contentHostWidth: number,\n): React.CSSProperties {\n const width = !hasDebugEntries\n ? '100%'\n : debugPaneOpen\n ? contentHostWidth > 0 ? `${contentHostWidth}px` : '100%'\n : fixtureColumnWidth === undefined ? '100%' : `${fixtureColumnWidth}px`;\n return {\n ...previewItemStyles.labelRow,\n width,\n maxWidth: '100%',\n };\n}\n\nconst previewItemStyles = {\n wrapper: {\n marginBottom: '0',\n } as React.CSSProperties,\n wrapperCompact: {\n marginBottom: '0',\n } as React.CSSProperties,\n labelRow: {\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n gap: '8px',\n marginBottom: '8px',\n } as React.CSSProperties,\n name: {\n fontSize: '12px',\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n nameCompact: {\n fontSize: '11px',\n fontWeight: 500,\n color: 'var(--component-explorer-descriptionForeground)',\n } as React.CSSProperties,\n dimensions: {\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n fontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n } as React.CSSProperties,\n pageHost: {\n width: '100%',\n minWidth: 0,\n } as React.CSSProperties,\n fixtureColumn: {\n minWidth: 0,\n } as React.CSSProperties,\n contentWithDebug: {\n width: '100%',\n minWidth: 0,\n } as React.CSSProperties,\n inlineDebug: {\n minWidth: 0,\n overflow: 'visible',\n borderRadius: '8px',\n backgroundColor: 'transparent',\n } as React.CSSProperties,\n debugSplitter: {\n width: '8px',\n cursor: 'col-resize',\n borderLeft: '1px solid var(--component-explorer-panel-border)',\n borderRight: '1px solid var(--component-explorer-panel-border)',\n backgroundColor: 'var(--component-explorer-sideBar-background)',\n touchAction: 'none',\n } as React.CSSProperties,\n debugToolbarGroup: {\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n minWidth: 0,\n marginLeft: 'auto',\n } as React.CSSProperties,\n debugHeaderHost: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n minWidth: 0,\n height: '24px',\n } as React.CSSProperties,\n viewportControls: {\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n } as React.CSSProperties,\n viewportSelect: {\n height: '24px',\n maxWidth: '120px',\n padding: '0 4px',\n border: '1px solid var(--component-explorer-input-border, var(--component-explorer-widget-border))',\n borderRadius: '3px',\n color: 'var(--component-explorer-input-foreground)',\n backgroundColor: 'var(--component-explorer-input-background)',\n fontSize: '11px',\n } as React.CSSProperties,\n dimensionInput: {\n width: '64px',\n height: '24px',\n padding: '0 4px',\n border: '1px solid var(--component-explorer-input-border, var(--component-explorer-widget-border))',\n borderRadius: '3px',\n color: 'var(--component-explorer-input-foreground)',\n backgroundColor: 'var(--component-explorer-input-background)',\n fontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n fontSize: '11px',\n boxSizing: 'border-box',\n } as React.CSSProperties,\n dimensionSeparator: {\n color: 'var(--component-explorer-descriptionForeground)',\n fontSize: '11px',\n } as React.CSSProperties,\n modeSelect: {\n height: '24px',\n padding: '0 4px',\n border: '1px solid var(--component-explorer-input-border, var(--component-explorer-widget-border))',\n borderRadius: '3px',\n color: 'var(--component-explorer-input-foreground)',\n backgroundColor: 'var(--component-explorer-input-background)',\n fontSize: '11px',\n } as React.CSSProperties,\n inputToggle: {\n height: '24px',\n padding: '0 7px',\n border: '1px solid var(--component-explorer-input-border, var(--component-explorer-widget-border))',\n borderRadius: '3px',\n color: 'var(--component-explorer-foreground)',\n backgroundColor: 'var(--component-explorer-input-background)',\n fontSize: '11px',\n cursor: 'pointer',\n } as React.CSSProperties,\n inputToggleActive: {\n color: 'var(--component-explorer-button-foreground)',\n backgroundColor: 'var(--component-explorer-button-background)',\n } as React.CSSProperties,\n inputSelectLabel: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: '4px',\n color: 'var(--component-explorer-descriptionForeground)',\n fontSize: '11px',\n } as React.CSSProperties,\n scaleText: {\n minWidth: '32px',\n color: 'var(--component-explorer-descriptionForeground)',\n fontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n fontSize: '11px',\n } as React.CSSProperties,\n embeddedLink: {\n marginLeft: 'auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '22px',\n height: '22px',\n borderRadius: '4px',\n color: 'var(--component-explorer-descriptionForeground)',\n textDecoration: 'none',\n opacity: 0.7,\n transition: 'opacity 0.1s, background-color 0.1s',\n cursor: 'pointer',\n } as React.CSSProperties,\n};\n\nfunction EmbeddedIcon(): React.ReactElement {\n return (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path d=\"M1.5 1H6v1H2v12h12v-4h1v4.5l-.5.5h-13l-.5-.5v-13l.5-.5zm8 0H15v5.5l-1-1V3.707L8.357 9.354l-.707-.708L13.293 3H10.5l-1-1z\" />\n </svg>\n );\n}\n\nfunction FixtureError({ error }: { error: ExceptionError }): React.ReactElement {\n const [expanded, setExpanded] = React.useState(false);\n\n return (\n <div style={errorStyles.container}>\n <button\n style={errorStyles.header}\n onClick={() => setExpanded(!expanded)}\n >\n <span style={errorStyles.chevron}>{expanded ? '▼' : '▶'}</span>\n <span style={errorStyles.message}>{error.message}</span>\n </button>\n {expanded && error.stack && (\n <pre style={errorStyles.stack}>{error.stack}</pre>\n )}\n </div>\n );\n}\n\nconst errorStyles = {\n container: {\n marginTop: '8px',\n borderRadius: '4px',\n backgroundColor: 'rgba(255, 80, 80, 0.1)',\n border: '1px solid rgba(255, 80, 80, 0.3)',\n overflow: 'hidden',\n } as React.CSSProperties,\n header: {\n display: 'flex',\n alignItems: 'flex-start',\n gap: '6px',\n width: '100%',\n padding: '8px 10px',\n backgroundColor: 'transparent',\n border: 'none',\n cursor: 'pointer',\n textAlign: 'left',\n fontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n fontSize: '12px',\n userSelect: 'text',\n } as React.CSSProperties,\n chevron: {\n fontSize: '10px',\n color: '#f77',\n flexShrink: 0,\n marginTop: '2px',\n } as React.CSSProperties,\n message: {\n color: '#f77',\n wordBreak: 'break-word',\n userSelect: 'text',\n } as React.CSSProperties,\n stack: {\n margin: 0,\n padding: '8px 10px',\n paddingTop: 0,\n fontSize: '11px',\n color: 'var(--component-explorer-descriptionForeground)',\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-word',\n lineHeight: 1.4,\n userSelect: 'text',\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue, autorun } from '@vscode/observables';\nimport { viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport type { DaemonModel, DaemonScreenshotResult } from '../daemon/index.js';\n\ntype ScreenshotState =\n\t| { readonly status: 'idle' }\n\t| { readonly status: 'loading' }\n\t| { readonly status: 'ready'; readonly data: DaemonScreenshotResult }\n\t| { readonly status: 'error'; readonly message: string };\n\nclass FixtureScreenshotModel extends ViewModel({\n\tfixtureId: prop.const<string>(),\n\tsessionName: prop.const<string>(),\n\tdaemon: prop.const<DaemonModel>(),\n}) {\n\treadonly screenshot = observableValue<ScreenshotState>(this, { status: 'idle' });\n\tprivate _fetchVersion = 0;\n\n\tget fixtureId() { return this.props.fixtureId; }\n\n\tconstructor(props: any) {\n\t\tsuper(props);\n\t\tthis._store.add(autorun(reader => {\n\t\t\tconst sourceTreeIds = this.props.daemon.sourceTreeIds.read(reader);\n\t\t\tconst stId = sourceTreeIds.get(this.props.sessionName);\n\t\t\tif (stId) {\n\t\t\t\tthis._fetchScreenshot();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate async _fetchScreenshot(): Promise<void> {\n\t\tconst version = ++this._fetchVersion;\n\t\tthis.screenshot.set({ status: 'loading' }, undefined);\n\t\ttry {\n\t\t\tconst data = await this.props.daemon.getScreenshot(this.props.sessionName, this.props.fixtureId);\n\t\t\tif (version === this._fetchVersion) {\n\t\t\t\tthis.screenshot.set({ status: 'ready', data }, undefined);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (version === this._fetchVersion) {\n\t\t\t\tthis.screenshot.set({ status: 'error', message: String(e) }, undefined);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Displays a single screenshot from the daemon, with loading/error states.\n * Re-fetches automatically when the session's sourceTreeId changes.\n */\nexport const FixtureScreenshotView = viewWithModel(\n\tFixtureScreenshotModel,\n\t{},\n\t(reader, model) => {\n\t\tconst state = model.screenshot.read(reader);\n\n\t\tif (state.status === 'idle' || state.status === 'loading') {\n\t\t\treturn (\n\t\t\t\t<div style={screenshotStyles.placeholder}>\n\t\t\t\t\t<div style={screenshotStyles.shimmer} />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tif (state.status === 'error') {\n\t\t\treturn (\n\t\t\t\t<div style={screenshotStyles.error}>\n\t\t\t\t\t<span style={screenshotStyles.errorText}>Screenshot failed</span>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\tconst { data } = state;\n\t\tif (!data.image) {\n\t\t\treturn (\n\t\t\t\t<div style={screenshotStyles.placeholder}>\n\t\t\t\t\t<span style={screenshotStyles.hashText}>{data.hash?.slice(0, 12)}</span>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<img\n\t\t\t\tsrc={`data:image/png;base64,${data.image}`}\n\t\t\t\tstyle={screenshotStyles.image}\n\t\t\t\talt={`Screenshot of ${model.fixtureId}`}\n\t\t\t/>\n\t\t);\n\t}\n);\n\nconst screenshotStyles = {\n\tplaceholder: {\n\t\tminHeight: 80,\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tjustifyContent: 'center',\n\t\tbackgroundColor: 'var(--component-explorer-editor-background)',\n\t\tborder: '1px solid var(--component-explorer-panel-border)',\n\t\tborderRadius: 4,\n\t\toverflow: 'hidden',\n\t} as React.CSSProperties,\n\tshimmer: {\n\t\twidth: '100%',\n\t\theight: 80,\n\t\tbackground: 'linear-gradient(90deg, var(--component-explorer-editor-background) 25%, var(--component-explorer-list-hoverBackground) 50%, var(--component-explorer-editor-background) 75%)',\n\t\tbackgroundSize: '200% 100%',\n\t\tanimation: 'shimmer 1.5s infinite',\n\t} as React.CSSProperties,\n\terror: {\n\t\tminHeight: 80,\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tjustifyContent: 'center',\n\t\tbackgroundColor: 'var(--component-explorer-inputValidation-errorBackground)',\n\t\tborder: '1px solid var(--component-explorer-inputValidation-errorBorder)',\n\t\tborderRadius: 4,\n\t} as React.CSSProperties,\n\terrorText: {\n\t\tfontSize: 12,\n\t\tcolor: 'var(--component-explorer-errorForeground)',\n\t} as React.CSSProperties,\n\thashText: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\tfontFamily: 'var(--component-explorer-editor-font-family, monospace)',\n\t} as React.CSSProperties,\n\timage: {\n\t\tmaxWidth: '100%',\n\t\tdisplay: 'block',\n\t\tborderRadius: 4,\n\t\tborder: '1px solid var(--component-explorer-panel-border)',\n\t} as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue, autorun } from '@vscode/observables';\nimport { view, viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport type { DaemonModel } from '../daemon/index.js';\nimport type { ScreenshotComparisonItem } from './ExplorerModel.js';\nimport { FixtureScreenshotView } from './FixtureScreenshotView.js';\n\ntype ComparisonStatus =\n\t| { readonly status: 'loading' }\n\t| { readonly status: 'ready'; readonly match: boolean }\n\t| { readonly status: 'error'; readonly message: string };\n\n// ---------------------------------------------------------------------------\n// Single fixture comparison (current vs baseline side-by-side)\n// ---------------------------------------------------------------------------\n\nclass SingleComparisonModel extends ViewModel({\n\tfixtureId: prop.const<string>(),\n\tdaemon: prop.const<DaemonModel>(),\n\tbaselineSession: prop.const<string>(),\n\tcurrentSession: prop.const<string>(),\n}) {\n\treadonly comparisonStatus = observableValue<ComparisonStatus>(this, { status: 'loading' });\n\n\tget fixtureId() { return this.props.fixtureId; }\n\tget daemon() { return this.props.daemon; }\n\tget baselineSession() { return this.props.baselineSession; }\n\tget currentSession() { return this.props.currentSession; }\n\n\tconstructor(props: any) {\n\t\tsuper(props);\n\t\tthis._store.add(autorun(reader => {\n\t\t\tconst sourceTreeIds = this.props.daemon.sourceTreeIds.read(reader);\n\t\t\tconst baselineStId = sourceTreeIds.get(this.props.baselineSession);\n\t\t\tconst currentStId = sourceTreeIds.get(this.props.currentSession);\n\t\t\tif (baselineStId && currentStId) {\n\t\t\t\tthis._fetchComparison();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate async _fetchComparison(): Promise<void> {\n\t\tthis.comparisonStatus.set({ status: 'loading' }, undefined);\n\t\ttry {\n\t\t\tconst result = await this.props.daemon.compare(\n\t\t\t\tthis.props.fixtureId,\n\t\t\t\tthis.props.baselineSession,\n\t\t\t\tthis.props.currentSession,\n\t\t\t);\n\t\t\tthis.comparisonStatus.set({ status: 'ready', match: result.match }, undefined);\n\t\t} catch (e) {\n\t\t\tthis.comparisonStatus.set({ status: 'error', message: String(e) }, undefined);\n\t\t}\n\t}\n}\n\nconst SingleComparison = viewWithModel(\n\tSingleComparisonModel,\n\t{},\n\t(reader, model) => {\n\t\tconst status = model.comparisonStatus.read(reader);\n\n\t\tconst statusBadge = status.status === 'loading'\n\t\t\t? <span style={compStyles.badgeLoading}>comparing...</span>\n\t\t\t: status.status === 'error'\n\t\t\t\t? <span style={compStyles.badgeError}>error</span>\n\t\t\t\t: status.match\n\t\t\t\t\t? <span style={compStyles.badgeMatch}>✓ match</span>\n\t\t\t\t\t: <span style={compStyles.badgeChanged}>● changed</span>;\n\n\t\treturn (\n\t\t\t<div style={compStyles.fixtureRow}>\n\t\t\t\t<div style={compStyles.fixtureLabel}>\n\t\t\t\t\t<span style={compStyles.fixtureName}>{model.fixtureId}</span>\n\t\t\t\t\t{statusBadge}\n\t\t\t\t</div>\n\t\t\t\t<div style={compStyles.sideBySide}>\n\t\t\t\t\t<div style={compStyles.screenshotColumn}>\n\t\t\t\t\t\t<span style={compStyles.columnLabel}>Current</span>\n\t\t\t\t\t\t<FixtureScreenshotView\n\t\t\t\t\t\t\tfixtureId={model.fixtureId}\n\t\t\t\t\t\t\tsessionName={model.currentSession}\n\t\t\t\t\t\t\tdaemon={model.daemon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div style={compStyles.screenshotColumn}>\n\t\t\t\t\t\t<span style={compStyles.columnLabel}>Baseline</span>\n\t\t\t\t\t\t<FixtureScreenshotView\n\t\t\t\t\t\t\tfixtureId={model.fixtureId}\n\t\t\t\t\t\t\tsessionName={model.baselineSession}\n\t\t\t\t\t\t\tdaemon={model.daemon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n);\n\n// ---------------------------------------------------------------------------\n// ScreenshotComparisonRow — renders a group of fixture comparisons\n// ---------------------------------------------------------------------------\n\nexport const ScreenshotComparisonRow = view(\n\t{\n\t\tname: prop.const<string>(),\n\t\tpath: prop.const<string>(),\n\t\titems: prop.const<readonly ScreenshotComparisonItem[]>(),\n\t\tdaemon: prop.const<DaemonModel>(),\n\t\tbaselineSession: prop.const<string>(),\n\t\tcurrentSession: prop.const<string>(),\n\t},\n\t(_reader, props) => {\n\t\treturn (\n\t\t\t<div style={compStyles.groupContent}>\n\t\t\t\t{props.items.map((item) => (\n\t\t\t\t\t<SingleComparison\n\t\t\t\t\t\tkey={item.fixtureId}\n\t\t\t\t\t\tfixtureId={item.fixtureId}\n\t\t\t\t\t\tdaemon={props.daemon}\n\t\t\t\t\t\tbaselineSession={props.baselineSession}\n\t\t\t\t\t\tcurrentSession={props.currentSession}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst compStyles = {\n\tgroupHeader: {\n\t\tmarginBottom: 12,\n\t} as React.CSSProperties,\n\tgroupTitle: {\n\t\tfontSize: 13,\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t} as React.CSSProperties,\n\tgroupContent: {\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'column',\n\t\tgap: 24,\n\t} as React.CSSProperties,\n\tfixtureRow: {\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'column',\n\t\tgap: 8,\n\t} as React.CSSProperties,\n\tfixtureLabel: {\n\t\tdisplay: 'flex',\n\t\talignItems: 'center',\n\t\tgap: 8,\n\t} as React.CSSProperties,\n\tfixtureName: {\n\t\tfontSize: 12,\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-foreground)',\n\t} as React.CSSProperties,\n\tsideBySide: {\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'row',\n\t\tgap: 16,\n\t} as React.CSSProperties,\n\tscreenshotColumn: {\n\t\tflex: 1,\n\t\tdisplay: 'flex',\n\t\tflexDirection: 'column',\n\t\tgap: 4,\n\t\tminWidth: 0,\n\t} as React.CSSProperties,\n\tcolumnLabel: {\n\t\tfontSize: 11,\n\t\tfontWeight: 500,\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\ttextTransform: 'uppercase',\n\t\tletterSpacing: '0.05em',\n\t} as React.CSSProperties,\n\tbadgeMatch: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-testing-iconPassed)',\n\t\tfontWeight: 500,\n\t} as React.CSSProperties,\n\tbadgeChanged: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-testing-iconFailed)',\n\t\tfontWeight: 500,\n\t} as React.CSSProperties,\n\tbadgeLoading: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-descriptionForeground)',\n\t\tfontStyle: 'italic',\n\t} as React.CSSProperties,\n\tbadgeError: {\n\t\tfontSize: 11,\n\t\tcolor: 'var(--component-explorer-errorForeground)',\n\t\tfontWeight: 500,\n\t} as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { view, prop } from '@vscode/observables-react';\nimport type { ReportFixtureEntry } from '../report/ScreenshotReport.js';\nimport type { ReportModel } from '../report/ReportModel.js';\n\nexport interface ReportFixtureItem {\n readonly fixtureId: string;\n readonly name: string;\n readonly path: string;\n readonly entry: ReportFixtureEntry;\n}\n\n// ---------------------------------------------------------------------------\n// Checkered canvas (same as FixturePreviewItem)\n// ---------------------------------------------------------------------------\n\nconst CHECKER_SIZE = 8;\n\nfunction createCheckerPattern(baseColor: string, checkerColor: string): string {\n return `\n linear-gradient(45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(-45deg, ${checkerColor} 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, ${checkerColor} 75%),\n linear-gradient(-45deg, transparent 75%, ${checkerColor} 75%)\n `;\n}\n\nconst lightPattern = {\n backgroundColor: '#ffffff',\n backgroundImage: createCheckerPattern('#ffffff', '#e5e5e5'),\n};\n\nconst darkPattern = {\n backgroundColor: '#1e1e1e',\n backgroundImage: createCheckerPattern('#1e1e1e', '#2d2d2d'),\n};\n\nconst canvasBaseStyle: React.CSSProperties = {\n display: 'inline-block',\n padding: '12px',\n borderRadius: '4px',\n backgroundSize: `${CHECKER_SIZE * 2}px ${CHECKER_SIZE * 2}px`,\n backgroundPosition: `0 0, 0 ${CHECKER_SIZE}px, ${CHECKER_SIZE}px -${CHECKER_SIZE}px, -${CHECKER_SIZE}px 0`,\n boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)',\n};\n\nfunction getCanvasStyle(background: 'light' | 'dark'): React.CSSProperties {\n const pattern = background === 'dark' ? darkPattern : lightPattern;\n return {\n ...canvasBaseStyle,\n backgroundColor: pattern.backgroundColor,\n backgroundImage: pattern.backgroundImage,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Screenshot image (natural size, no scaling)\n// ---------------------------------------------------------------------------\n\nfunction ScreenshotImage({ src, alt, background }: {\n src: string;\n alt: string;\n background: 'light' | 'dark';\n}) {\n return (\n <div style={getCanvasStyle(background)}>\n <img src={src} alt={alt} style={styles.image} />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Single fixture comparison\n// ---------------------------------------------------------------------------\n\nconst ReportFixtureView = view(\n {\n item: prop.const<ReportFixtureItem>(),\n reportModel: prop.const<ReportModel>(),\n },\n (_reader, props) => {\n const { item, reportModel } = props;\n const { entry } = item;\n const background = entry.background ?? 'light';\n\n const statusBadge = entry.status === 'unchanged'\n ? <span style={styles.badgeMatch}>✓ match</span>\n : entry.status === 'changed'\n ? <span style={styles.badgeChanged}>● changed</span>\n : <span style={styles.badgeAdded}>+ added</span>;\n\n const hasScreenshots = entry.baselineScreenshot || entry.currentScreenshot;\n\n return (\n <div style={styles.fixtureRow}>\n <div style={styles.fixtureLabel}>\n <span style={styles.fixtureName}>{item.fixtureId}</span>\n {statusBadge}\n </div>\n {hasScreenshots && (\n <div style={styles.sideBySide}>\n {entry.baselineScreenshot && (\n <div style={styles.screenshotColumn}>\n <span style={styles.columnLabel}>Baseline</span>\n <ScreenshotImage\n src={reportModel.resolveScreenshotUrl(entry.baselineScreenshot)}\n alt={`Baseline screenshot of ${item.fixtureId}`}\n background={background}\n />\n </div>\n )}\n {entry.currentScreenshot && (\n <div style={styles.screenshotColumn}>\n <span style={styles.columnLabel}>Current</span>\n <ScreenshotImage\n src={reportModel.resolveScreenshotUrl(entry.currentScreenshot)}\n alt={`Current screenshot of ${item.fixtureId}`}\n background={background}\n />\n </div>\n )}\n </div>\n )}\n {!hasScreenshots && entry.status === 'unchanged' && (\n <div style={styles.hashRow}>\n <span style={styles.hashText}>hash: {entry.targetHash}</span>\n </div>\n )}\n </div>\n );\n }\n);\n\nexport const ReportComparisonRow = view(\n {\n name: prop.const<string>(),\n path: prop.const<string>(),\n items: prop.const<readonly ReportFixtureItem[]>(),\n reportModel: prop.const<ReportModel>(),\n },\n (_reader, props) => {\n return (\n <div style={styles.groupContent}>\n {props.items.map((item) => (\n <ReportFixtureView\n key={item.fixtureId}\n item={item}\n reportModel={props.reportModel}\n />\n ))}\n </div>\n );\n }\n);\n\nconst styles = {\n groupHeader: {\n marginBottom: 12,\n } as React.CSSProperties,\n groupTitle: {\n fontSize: 13,\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n groupContent: {\n display: 'flex',\n flexDirection: 'column',\n gap: 24,\n } as React.CSSProperties,\n fixtureRow: {\n display: 'flex',\n flexDirection: 'column',\n gap: 8,\n } as React.CSSProperties,\n fixtureLabel: {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n } as React.CSSProperties,\n fixtureName: {\n fontSize: 12,\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n sideBySide: {\n display: 'flex',\n flexDirection: 'row',\n gap: 16,\n } as React.CSSProperties,\n screenshotColumn: {\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n } as React.CSSProperties,\n columnLabel: {\n fontSize: 11,\n fontWeight: 500,\n color: 'var(--component-explorer-descriptionForeground)',\n textTransform: 'uppercase',\n letterSpacing: '0.05em',\n } as React.CSSProperties,\n image: {\n display: 'block',\n } as React.CSSProperties,\n hashRow: {\n padding: '8px 0',\n } as React.CSSProperties,\n hashText: {\n fontSize: 11,\n color: 'var(--component-explorer-descriptionForeground)',\n fontFamily: 'monospace',\n } as React.CSSProperties,\n badgeMatch: {\n fontSize: 11,\n color: 'var(--component-explorer-testing-iconPassed)',\n fontWeight: 500,\n } as React.CSSProperties,\n badgeChanged: {\n fontSize: 11,\n color: 'var(--component-explorer-testing-iconFailed)',\n fontWeight: 500,\n } as React.CSSProperties,\n badgeAdded: {\n fontSize: 11,\n color: 'var(--component-explorer-testing-iconQueued)',\n fontWeight: 500,\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue, derived } from '@vscode/observables';\nimport { view, viewWithModel, ViewModel, prop } from '@vscode/observables-react';\nimport type { ExplorerModel, PreviewRow } from './ExplorerModel.js';\nimport { FixturePreviewItem } from './FixturePreviewItem.js';\nimport type { FixtureInputStore } from '../core/index.js';\nimport { buildQueryParamUrl } from '../lib/queryParamObservable.js';\nimport { ScreenshotComparisonRow } from './ScreenshotComparisonRow.js';\nimport { ReportComparisonRow } from './ReportComparisonRow.js';\nimport { getAllCachedHeights, setCachedHeight } from '../lib/fixtureSizeCache.js';\nimport type { FixtureViewportStore } from './PageViewportState.js';\nimport type { FixtureDebugStore } from './FixtureDebugStore.js';\nimport type { DebugWorkbenchStateStore } from './DebugWorkbenchState.js';\n\nconst ESTIMATED_ROW_HEIGHT = 280;\nconst ROW_GAP = 32;\nconst CONTENT_PADDING = 32;\nconst OVERSCAN_PX = 400;\n\n// ---------------------------------------------------------------------------\n// Scroll debug logging\n// ---------------------------------------------------------------------------\n\nconst logScroll = false;\nlet _scrollLogSeq = 0;\n\nfunction scrollLog(tag: string, data: Record<string, unknown>): void {\n if (!logScroll) return;\n const seq = ++_scrollLogSeq;\n const ts = performance.now().toFixed(1);\n console.log(\n `%c[scroll #${seq} @${ts}ms] ${tag}`,\n 'color: #3b82f6; font-weight: bold',\n data,\n );\n}\n\nfunction scrollWarn(tag: string, data: Record<string, unknown>): void {\n if (!logScroll) return;\n const seq = ++_scrollLogSeq;\n const ts = performance.now().toFixed(1);\n console.warn(\n `[scroll #${seq} @${ts}ms] ${tag}`,\n data,\n );\n}\n\nconst SCROLL_ANCHOR_KEY = 'component-explorer:scrollAnchors';\nconst MAX_ANCHOR_ENTRIES = 100;\n\n// ---------------------------------------------------------------------------\n// Scroll anchor persistence (row index + offset, not absolute scrollTop)\n// ---------------------------------------------------------------------------\n\ninterface ScrollAnchor {\n readonly rowIndex: number;\n readonly offsetFromViewport: number;\n}\n\nfunction loadScrollAnchors(): Record<string, ScrollAnchor> {\n try {\n const stored = localStorage.getItem(SCROLL_ANCHOR_KEY);\n if (stored) return JSON.parse(stored);\n } catch { /* ignore */ }\n return {};\n}\n\nfunction saveScrollAnchor(nodeId: string, anchor: ScrollAnchor): void {\n try {\n const all = loadScrollAnchors();\n all[nodeId] = anchor;\n const entries = Object.entries(all);\n const pruned = entries.length > MAX_ANCHOR_ENTRIES\n ? Object.fromEntries(entries.slice(-MAX_ANCHOR_ENTRIES))\n : all;\n localStorage.setItem(SCROLL_ANCHOR_KEY, JSON.stringify(pruned));\n } catch { /* ignore */ }\n}\n\nfunction getScrollAnchor(nodeId: string): ScrollAnchor | undefined {\n return loadScrollAnchors()[nodeId];\n}\n\n// ---------------------------------------------------------------------------\n// Layout computation (pure functions over data)\n// ---------------------------------------------------------------------------\n\ninterface RowLayout {\n readonly top: number;\n readonly height: number;\n}\n\nfunction getRowId(row: PreviewRow): string {\n return row.type === 'single' ? row.fixture.id : row.id;\n}\n\nfunction computeLayout(\n rows: readonly PreviewRow[],\n heightCache: ReadonlyMap<string, number>,\n): readonly RowLayout[] {\n const result: RowLayout[] = new Array(rows.length);\n let top = CONTENT_PADDING;\n for (let i = 0; i < rows.length; i++) {\n const height = heightCache.get(getRowId(rows[i])) ?? ESTIMATED_ROW_HEIGHT;\n result[i] = { top, height };\n top += height + ROW_GAP;\n }\n return result;\n}\n\nfunction layoutTotalHeight(layout: readonly RowLayout[]): number {\n if (layout.length === 0) return 0;\n const last = layout[layout.length - 1];\n return last.top + last.height + CONTENT_PADDING;\n}\n\n/** Binary search for first row whose bottom edge is >= y. */\nfunction findFirstVisibleRow(layout: readonly RowLayout[], y: number): number {\n let lo = 0;\n let hi = layout.length;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (layout[mid].top + layout[mid].height < y) {\n lo = mid + 1;\n } else {\n hi = mid;\n }\n }\n return lo;\n}\n\n/** Find visible row range for a given scrollTop + viewportHeight. */\nfunction computeVisibleRange(\n layout: readonly RowLayout[],\n scrollTop: number,\n viewportHeight: number,\n): { readonly start: number; readonly end: number } {\n if (layout.length === 0) return { start: 0, end: 0 };\n const start = findFirstVisibleRow(layout, scrollTop - OVERSCAN_PX);\n let end = start;\n const bottom = scrollTop + viewportHeight + OVERSCAN_PX;\n while (end < layout.length && layout[end].top < bottom) {\n end++;\n }\n return { start, end };\n}\n\n/** Find the row closest to the viewport top edge. */\nfunction computeAnchor(\n layout: readonly RowLayout[],\n scrollTop: number,\n): ScrollAnchor | undefined {\n if (layout.length === 0) return undefined;\n const idx = findFirstVisibleRow(layout, scrollTop);\n const rowIndex = Math.min(idx, layout.length - 1);\n return {\n rowIndex,\n offsetFromViewport: layout[rowIndex].top - scrollTop,\n };\n}\n\n/** Compute scrollTop to restore an anchor. */\nfunction scrollTopForAnchor(\n layout: readonly RowLayout[],\n anchor: ScrollAnchor,\n): number {\n if (anchor.rowIndex >= layout.length) return 0;\n return layout[anchor.rowIndex].top - anchor.offsetFromViewport;\n}\n\n// ---------------------------------------------------------------------------\n// Path headings\n// ---------------------------------------------------------------------------\n\nfunction getRowPath(row: PreviewRow): string {\n return row.type === 'single' ? row.fixture.path : row.path;\n}\n\nfunction getPathSegments(path: string): readonly string[] {\n return path.split(' / ').slice(1);\n}\n\ninterface HeadingInfo {\n readonly depth: number;\n readonly name: string;\n readonly nodeId: string;\n}\n\nfunction computeNewHeadings(\n current: readonly string[],\n previous: readonly string[] | undefined,\n rowId: string,\n): readonly HeadingInfo[] {\n const idSegments = rowId.split('/');\n const offset = idSegments.length - current.length;\n for (let i = 0; i < current.length; i++) {\n if (!previous || i >= previous.length || current[i] !== previous[i]) {\n return current.slice(i).map((name, j) => ({\n depth: i + j,\n name,\n nodeId: idSegments.slice(0, offset + i + j + 1).join('/'),\n }));\n }\n }\n return [];\n}\n\nconst headingTags = ['h1', 'h2', 'h3', 'h4'] as const;\n\nfunction headingTagForDepth(depth: number): (typeof headingTags)[number] {\n return headingTags[Math.min(depth, headingTags.length - 1)];\n}\n\nconst headingFontSizes = ['22px', '15px', '13px', '12px'];\n\nfunction headingStyleForDepth(depth: number): React.CSSProperties {\n return {\n fontSize: headingFontSizes[Math.min(depth, headingFontSizes.length - 1)],\n fontWeight: depth <= 1 ? 600 : 500,\n color: 'var(--component-explorer-foreground)',\n margin: 0,\n marginBottom: depth === 0 ? '8px' : '4px',\n paddingBottom: depth === 0 ? '6px' : undefined,\n borderBottom: depth === 0 ? '1px solid var(--component-explorer-widget-border, var(--component-explorer-panel-border, rgba(128,128,128,0.35)))' : undefined,\n };\n}\n\n// ---------------------------------------------------------------------------\n// PreviewAreaModel\n// ---------------------------------------------------------------------------\n\nclass PreviewAreaModel extends ViewModel({\n model: prop.const<ExplorerModel>(),\n}) {\n private readonly _rowHeights = observableValue<ReadonlyMap<string, number>>(this, getAllCachedHeights());\n private readonly _scrollTop = observableValue<number>(this, 0);\n readonly viewportHeight = observableValue<number>(this, 0);\n\n private _scrollContainerRef: HTMLDivElement | null = null;\n private _resizeObserver: ResizeObserver | null = null;\n private _viewportResizeObserver: ResizeObserver | null = null;\n private _currentNodeId: string | undefined = undefined;\n private _scrollSaveTimeout: ReturnType<typeof setTimeout> | null = null;\n private _suppressScrollHandler = false;\n\n get explorerModel() { return this.props.model; }\n\n get currentSessionName(): string {\n const daemon = this.explorerModel.daemon;\n if (!daemon) return 'current';\n const sessions = daemon.sessions.get();\n return sessions.find(s => s.sourceKind === 'current')?.name ?? sessions[0]?.name ?? 'current';\n }\n\n get baselineSessionName(): string {\n const daemon = this.explorerModel.daemon;\n if (!daemon) return 'baseline';\n const sessions = daemon.sessions.get();\n return sessions.find(s => s.sourceKind === 'worktree')?.name ?? sessions[1]?.name ?? 'baseline';\n }\n\n readonly layout = derived(this, (reader) => {\n const rows = this.explorerModel.selectedFixtures.read(reader);\n const heights = this._rowHeights.read(reader);\n return computeLayout(rows, heights);\n });\n\n readonly visibleRowRange = derived(this, (reader) => {\n const layout = this.layout.read(reader);\n const scrollTop = this._scrollTop.read(reader);\n const viewportHeight = this.viewportHeight.read(reader);\n return computeVisibleRange(layout, scrollTop, viewportHeight);\n });\n\n setScrollContainerRef = (el: HTMLDivElement | null): void => {\n if (this._scrollContainerRef) {\n this._scrollContainerRef.removeEventListener('scroll', this._handleScroll);\n }\n this._viewportResizeObserver?.disconnect();\n\n this._scrollContainerRef = el;\n if (!el) return;\n\n el.addEventListener('scroll', this._handleScroll, { passive: true });\n this.viewportHeight.set(el.clientHeight, undefined);\n scrollLog('setScrollContainerRef', { clientHeight: el.clientHeight, scrollTop: el.scrollTop });\n\n this._viewportResizeObserver = new ResizeObserver(([entry]) => {\n const h = Math.round(entry.contentRect.height);\n const prev = this.viewportHeight.get();\n if (h !== prev) {\n scrollLog('viewportResize', { prev, new: h });\n }\n this.viewportHeight.set(h, undefined);\n });\n this._viewportResizeObserver.observe(el);\n\n this._restoreScrollPosition();\n };\n\n updateForSelection(nodeId: string | undefined): void {\n if (this._currentNodeId === nodeId) return;\n scrollLog('updateForSelection', { prev: this._currentNodeId, new: nodeId });\n this._currentNodeId = nodeId;\n this._restoreScrollPosition();\n }\n\n private _restoreScrollPosition(): void {\n if (!this._scrollContainerRef || !this._currentNodeId) return;\n const anchor = getScrollAnchor(this._currentNodeId);\n if (!anchor) {\n scrollLog('restoreScroll:noAnchor', { nodeId: this._currentNodeId });\n return;\n }\n\n const layout = this.layout.get();\n const target = scrollTopForAnchor(layout, anchor);\n const prevScrollTop = this._scrollContainerRef.scrollTop;\n\n scrollLog('restoreScroll', {\n nodeId: this._currentNodeId,\n anchor,\n prevScrollTop,\n targetScrollTop: target,\n delta: target - prevScrollTop,\n layoutLength: layout.length,\n });\n\n this._suppressScrollHandler = true;\n this._scrollContainerRef.scrollTop = target;\n this._scrollTop.set(target, undefined);\n requestAnimationFrame(() => { this._suppressScrollHandler = false; });\n }\n\n private _handleScroll = (): void => {\n if (!this._scrollContainerRef) return;\n const prevObsScrollTop = this._scrollTop.get();\n const newScrollTop = this._scrollContainerRef.scrollTop;\n const delta = newScrollTop - prevObsScrollTop;\n this._scrollTop.set(newScrollTop, undefined);\n\n if (Math.abs(delta) > 200) {\n scrollWarn('handleScroll:LARGE_JUMP', {\n prevObsScrollTop,\n newScrollTop,\n delta,\n suppressed: this._suppressScrollHandler,\n stack: new Error().stack,\n });\n }\n\n if (this._suppressScrollHandler || !this._currentNodeId) {\n if (this._suppressScrollHandler) {\n scrollLog('handleScroll:suppressed', { newScrollTop, delta });\n }\n return;\n }\n if (this._scrollSaveTimeout) clearTimeout(this._scrollSaveTimeout);\n this._scrollSaveTimeout = setTimeout(() => {\n if (!this._currentNodeId) return;\n const layout = this.layout.get();\n const anchor = computeAnchor(layout, this._scrollTop.get());\n if (anchor) saveScrollAnchor(this._currentNodeId, anchor);\n }, 150);\n };\n\n observeRowElement = (el: HTMLDivElement | null, id: string): void => {\n if (!el) return;\n if (!this._resizeObserver) {\n this._resizeObserver = new ResizeObserver((entries) => {\n const current = this._rowHeights.get();\n let newMap: Map<string, number> | undefined;\n const changedRows: { rid: string; oldH: number | undefined; newH: number }[] = [];\n for (const entry of entries) {\n const rid = entry.target.getAttribute('data-row-id');\n if (!rid) continue;\n const height = Math.round(entry.contentRect.height);\n if (height > 0 && current.get(rid) !== height) {\n changedRows.push({ rid, oldH: current.get(rid), newH: height });\n if (!newMap) newMap = new Map(current);\n newMap.set(rid, height);\n setCachedHeight(rid, height);\n }\n }\n if (newMap) {\n const oldLayout = this.layout.get();\n const scrollTopBefore = this._scrollTop.get();\n const anchor = computeAnchor(oldLayout, scrollTopBefore);\n\n this._rowHeights.set(newMap, undefined);\n\n const newLayout = this.layout.get();\n\n if (anchor && this._scrollContainerRef) {\n const newScrollTop = scrollTopForAnchor(newLayout, anchor);\n const delta = newScrollTop - scrollTopBefore;\n\n if (Math.abs(delta) > 2) {\n scrollLog('resizeObserver:reAnchor', {\n changedRows,\n anchor,\n scrollTopBefore,\n newScrollTop,\n delta,\n oldTotalHeight: layoutTotalHeight(oldLayout),\n newTotalHeight: layoutTotalHeight(newLayout),\n });\n }\n if (Math.abs(delta) > 200) {\n scrollWarn('resizeObserver:LARGE_REANCHOR', {\n changedRows,\n anchor,\n scrollTopBefore,\n newScrollTop,\n delta,\n });\n }\n\n this._suppressScrollHandler = true;\n this._scrollContainerRef.scrollTop = newScrollTop;\n this._scrollTop.set(newScrollTop, undefined);\n requestAnimationFrame(() => { this._suppressScrollHandler = false; });\n }\n }\n });\n }\n el.setAttribute('data-row-id', id);\n this._resizeObserver.observe(el);\n };\n\n dispose(): void {\n this._resizeObserver?.disconnect();\n this._viewportResizeObserver?.disconnect();\n if (this._scrollContainerRef) {\n this._scrollContainerRef.removeEventListener('scroll', this._handleScroll);\n }\n if (this._scrollSaveTimeout) clearTimeout(this._scrollSaveTimeout);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Views\n// ---------------------------------------------------------------------------\n\nexport const PreviewArea = viewWithModel(\n PreviewAreaModel,\n {},\n (reader, model) => {\n const rows = model.explorerModel.selectedFixtures.read(reader);\n const selectedNodeId = model.explorerModel.selectedNodeId.read(reader);\n const layout = model.layout.read(reader);\n const { start, end } = model.visibleRowRange.read(reader);\n const availablePageHeight = Math.max(0, model.viewportHeight.read(reader) - CONTENT_PADDING * 2);\n\n model.updateForSelection(selectedNodeId);\n\n if (rows.length === 0) {\n const reportModel = model.explorerModel.reportModel;\n if (reportModel) {\n const reportState = reportModel.state.read(reader);\n if (reportState.status === 'loading') {\n return (\n <div style={styles.emptyState}>\n <span style={styles.emptyText}>Loading report...</span>\n </div>\n );\n }\n if (reportState.status === 'error') {\n return (\n <div style={styles.emptyState}>\n <span style={{ ...styles.emptyText, color: 'var(--component-explorer-errorForeground)' }}>\n Failed to load report: {reportState.message}\n </span>\n </div>\n );\n }\n }\n return (\n <div style={styles.emptyState}>\n <span style={styles.emptyText}>Select a component or folder to preview</span>\n </div>\n );\n }\n\n const total = layoutTotalHeight(layout);\n\n return (\n <div ref={model.setScrollContainerRef} style={styles.scrollContainer}>\n <div style={{ position: 'relative', height: total }}>\n {rows.slice(start, end).map((row, i) => {\n const idx = start + i;\n const { top } = layout[idx];\n const id = getRowId(row);\n\n const currentSegments = getPathSegments(getRowPath(row));\n const prevSegments = idx > 0 ? getPathSegments(getRowPath(rows[idx - 1])) : undefined;\n const newHeadings = computeNewHeadings(currentSegments, prevSegments, id);\n\n return (\n <div\n key={id}\n ref={(el) => model.observeRowElement(el, id)}\n style={{ position: 'absolute', top, left: CONTENT_PADDING, right: CONTENT_PADDING }}\n >\n {newHeadings.map((h) => {\n const Tag = headingTagForDepth(h.depth);\n return (\n <Tag key={h.depth} style={headingStyleForDepth(h.depth)}>\n <a\n href={buildQueryParamUrl('fixture', h.nodeId)}\n style={styles.headingLink}\n onClick={(e) => { e.preventDefault(); model.explorerModel.selectNode(h.nodeId); }}\n >{h.name}</a>\n </Tag>\n );\n })}\n {row.type === 'single' ? (\n <FixturePreviewItem fixture={row.fixture} compact={false} onSelect={model.explorerModel.selectNode} inputStore={model.explorerModel.inputStore} viewportStore={model.explorerModel.viewportStore} availablePageHeight={availablePageHeight} debugStore={model.explorerModel.debugStore} debugWorkbenchState={model.explorerModel.debugWorkbenchState} logicalFixtureCount={1} />\n ) : row.type === 'variants' ? (\n <VariantsRowView row={row} onSelect={model.explorerModel.selectNode} inputStore={model.explorerModel.inputStore} viewportStore={model.explorerModel.viewportStore} availablePageHeight={availablePageHeight} debugStore={model.explorerModel.debugStore} debugWorkbenchState={model.explorerModel.debugWorkbenchState} />\n ) : row.type === 'screenshot-comparison' && model.explorerModel.daemon ? (\n <ScreenshotComparisonRow\n name={row.name}\n path={row.path}\n items={row.items}\n daemon={model.explorerModel.daemon}\n baselineSession={model.baselineSessionName}\n currentSession={model.currentSessionName}\n />\n ) : row.type === 'report-comparison' && model.explorerModel.reportModel ? (\n <ReportComparisonRow\n name={row.name}\n path={row.path}\n items={row.items}\n reportModel={model.explorerModel.reportModel}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n );\n }\n);\n\ntype VariantsRowData = Extract<PreviewRow, { type: 'variants' }>;\n\nconst VariantsRowView = view(\n {\n row: prop.const<VariantsRowData>(),\n onSelect: prop.const<(nodeId: string) => void>(),\n inputStore: prop.const<FixtureInputStore | undefined>(),\n viewportStore: prop.const<FixtureViewportStore>(),\n availablePageHeight: prop.const<number>(),\n debugStore: prop.const<FixtureDebugStore>(),\n debugWorkbenchState: prop.const<DebugWorkbenchStateStore>(),\n },\n (_reader, props) => {\n const row = props.row;\n return (\n <div style={styles.variantsContent}>\n {row.fixtures.map((fixture) => (\n <FixturePreviewItem key={fixture.id} fixture={fixture} compact onSelect={props.onSelect} inputStore={props.inputStore} viewportStore={props.viewportStore} availablePageHeight={props.availablePageHeight} debugStore={props.debugStore} debugWorkbenchState={props.debugWorkbenchState} logicalFixtureCount={row.fixtures.length} />\n ))}\n </div>\n );\n }\n);\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst styles = {\n scrollContainer: {\n flex: 1,\n overflow: 'auto',\n backgroundColor: 'var(--component-explorer-editor-background)',\n } as React.CSSProperties,\n emptyState: {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: 'var(--component-explorer-editor-background)',\n } as React.CSSProperties,\n emptyText: {\n color: 'var(--component-explorer-descriptionForeground)',\n fontSize: '14px',\n } as React.CSSProperties,\n variantsHeader: {\n marginBottom: '12px',\n } as React.CSSProperties,\n variantsTitle: {\n fontSize: '13px',\n fontWeight: 500,\n color: 'var(--component-explorer-foreground)',\n } as React.CSSProperties,\n variantsContent: {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n gap: '16px',\n } as React.CSSProperties,\n headingLink: {\n textDecoration: 'none',\n color: 'inherit',\n } as React.CSSProperties,\n};\n","import * as React from 'react';\nimport { observableValue, type IReader } from '@vscode/observables';\nimport { prop, ViewModel, viewWithModel } from '@vscode/observables-react';\nimport type { ConsoleEventsStore } from '../core/ConsoleEventsStore.js';\nimport { OUTPUT_DEBUG_PANEL_ID } from '../core/FixtureInteractionRuntime.js';\nimport type { ExplorerModel, FixtureItem } from './ExplorerModel.js';\nimport { DebugWorkbench, type DebugWorkbenchEntry } from './DebugWorkbench.js';\nimport { resolveDebugPanelPlacement } from './DebugPanelPlacement.js';\n\ninterface EntryCandidate extends DebugWorkbenchEntry {\n readonly typeId: string;\n}\n\nclass BottomDebugPanelModel extends ViewModel({\n model: prop.const<ExplorerModel>(),\n consoleStore: prop.const<ConsoleEventsStore>(),\n}) {\n readonly headerHost = observableValue<HTMLElement | null>(this, null);\n\n get model(): ExplorerModel { return this.props.model; }\n get consoleStore(): ConsoleEventsStore { return this.props.consoleStore; }\n\n setHeaderHost = (element: HTMLDivElement | null): void => {\n this.headerHost.set(element, undefined);\n };\n}\n\nexport const BottomDebugPanel = viewWithModel(\n BottomDebugPanelModel,\n {},\n (reader, panelModel) => {\n const rows = panelModel.model.selectedFixtures.read(reader);\n const candidates: EntryCandidate[] = [];\n\n for (const row of rows) {\n if (row.type === 'single') {\n collectFixtureEntries(row.fixture, 1, panelModel.model, reader, candidates);\n } else if (row.type === 'variants') {\n for (const fixture of row.fixtures) {\n collectFixtureEntries(fixture, row.fixtures.length, panelModel.model, reader, candidates);\n }\n }\n }\n\n const counts = new Map<string, number>();\n for (const candidate of candidates) {\n counts.set(candidate.typeId, (counts.get(candidate.typeId) ?? 0) + 1);\n }\n const entries = candidates.map(({ typeId, ...candidate }) => ({\n ...candidate,\n title: (counts.get(typeId) ?? 0) > 1\n ? `${candidate.fixtureName}: ${candidate.title}`\n : candidate.title,\n }));\n const consoleEvents = panelModel.consoleStore.events.read(reader);\n if (entries.length === 0 && consoleEvents.length === 0) {\n return null;\n }\n\n const workbenchId = `bottom:${panelModel.model.selectedNodeId.read(reader) ?? 'root'}`;\n const activeEntry = panelModel.model.debugWorkbenchState.getActiveEntry(workbenchId);\n const activeEntryKey = activeEntry.read(reader);\n const contentVisible = activeEntryKey !== undefined;\n return (\n <div style={contentVisible ? styles.containerOpen : styles.containerClosed}>\n {!contentVisible && (\n <div style={styles.toolbar}>\n <div ref={panelModel.setHeaderHost} style={styles.headerHost} />\n </div>\n )}\n <div style={contentVisible ? styles.workbenchOpen : styles.workbenchClosed}>\n <DebugWorkbench\n workbenchId={workbenchId}\n entries={entries}\n activeEntryKey={activeEntryKey ?? '$console'}\n externalHeaderHost={panelModel.headerHost.read(reader)}\n contentVisible={contentVisible}\n onActiveEntryChange={entryKey => activeEntry.set(entryKey, undefined)}\n onClose={() => activeEntry.set(undefined, undefined)}\n store={panelModel.model.debugStore}\n stateStore={panelModel.model.debugWorkbenchState}\n consoleStore={panelModel.consoleStore}\n popOutHref={undefined}\n floatTopHeaders={false}\n />\n </div>\n </div>\n );\n },\n);\n\nfunction collectFixtureEntries(\n fixture: FixtureItem,\n logicalFixtureCount: number,\n model: ExplorerModel,\n reader: IReader,\n target: EntryCandidate[],\n): void {\n for (const panel of fixture.component.debugPanels) {\n if (resolveDebugPanelPlacement(panel.placement, logicalFixtureCount) !== 'bottom-panel') continue;\n target.push({\n key: `${fixture.id}:${panel.id}`,\n typeId: panel.id,\n fixtureId: fixture.id,\n fixtureName: fixture.name,\n panelId: panel.id,\n title: panel.title,\n definition: panel,\n });\n }\n\n const info = model.debugStore.read(reader, fixture.id);\n if (logicalFixtureCount > 1 && info?.ready && info.hasOutput) {\n target.push({\n key: `${fixture.id}:${OUTPUT_DEBUG_PANEL_ID}`,\n typeId: OUTPUT_DEBUG_PANEL_ID,\n fixtureId: fixture.id,\n fixtureName: fixture.name,\n panelId: OUTPUT_DEBUG_PANEL_ID,\n title: 'Output',\n outputEditable: info.outputEditable,\n });\n }\n}\n\nconst styles = {\n containerOpen: {\n position: 'relative',\n height: '260px',\n minHeight: '140px',\n flex: '0 0 auto',\n padding: '0 8px 8px',\n boxSizing: 'border-box',\n backgroundColor: 'var(--component-explorer-editor-background)',\n } as React.CSSProperties,\n containerClosed: {\n height: '28px',\n flex: '0 0 auto',\n padding: '0 8px',\n backgroundColor: 'var(--component-explorer-editor-background)',\n } as React.CSSProperties,\n toolbar: {\n display: 'flex',\n height: '28px',\n alignItems: 'center',\n borderTop: '1px solid var(--component-explorer-panel-border)',\n } as React.CSSProperties,\n headerHost: {\n flex: 1,\n minWidth: 0,\n } as React.CSSProperties,\n workbenchOpen: {\n height: '100%',\n minHeight: 0,\n } as React.CSSProperties,\n workbenchClosed: {\n height: 0,\n minHeight: 0,\n overflow: 'hidden',\n } as React.CSSProperties,\n};\n","import { viewWithModel, prop } from '@vscode/observables-react';\nimport { ExplorerModel } from './ExplorerModel.js';\nimport { TitleBar } from './TitleBar.js';\nimport { LeftSidebar } from './LeftSidebar.js';\nimport { RightSidebar } from './RightSidebar.js';\nimport { PreviewArea } from './PreviewArea.js';\nimport { BottomDebugPanel } from './BottomDebugPanel.js';\nimport { ConsoleEventsStore } from '../core/ConsoleEventsStore.js';\nimport { styles } from './styles.js';\nimport type { DaemonModel } from '../daemon/index.js';\nimport type { ReportModel } from '../report/ReportModel.js';\n\n// Install global console events capture\nconst consoleEventsStore = ConsoleEventsStore.getInstance();\nconsoleEventsStore.install();\n\nconst loadingStyle: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: '12px',\n height: '100%',\n width: '100%',\n color: 'var(--component-explorer-foreground)',\n opacity: 0.5,\n fontSize: '13px',\n};\n\nconst spinnerStyle: React.CSSProperties = {\n width: '24px',\n height: '24px',\n border: '2px solid currentColor',\n borderTopColor: 'transparent',\n borderRadius: '50%',\n animation: 'explorer-spin 0.8s linear infinite',\n};\n\nexport const Explorer = viewWithModel(\n ExplorerModel,\n { daemonModel: prop.const<DaemonModel | undefined>(), reportModel: prop.const<ReportModel | undefined>() },\n (reader, model) => {\n const isDarkTheme = model.isDarkTheme.read(reader);\n const loading = model.loading.read(reader);\n const error = model.error.read(reader);\n\n const themeClass = isDarkTheme ? 'vscode-theme default-dark-plus' : 'vscode-theme default-light-plus';\n\n if (error) {\n return (\n <div className={themeClass} style={{ ...styles.container, backgroundColor: 'var(--component-explorer-editor-background)' }}>\n <div style={{ ...loadingStyle, userSelect: 'text', cursor: 'text' }}>\n <span style={{ color: 'var(--component-explorer-errorForeground)' }}>Failed to load fixtures</span>\n <pre style={{ fontSize: '12px', opacity: 0.7, whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0, fontFamily: 'inherit' }}>{error}</pre>\n </div>\n </div>\n );\n }\n\n if (loading) {\n return (\n <div className={themeClass} style={{ ...styles.container, backgroundColor: 'var(--component-explorer-editor-background)' }}>\n <style>{`@keyframes explorer-spin { to { transform: rotate(360deg); } }`}</style>\n <div style={loadingStyle}>\n <div style={spinnerStyle} />\n Loading fixtures…\n </div>\n </div>\n );\n }\n\n const leftVisible = model.leftSidebarVisible.read(reader);\n const rightVisible = model.rightSidebarVisible.read(reader);\n const selectedNode = model.selectedNode.read(reader);\n\n return (\n <div className={themeClass} style={styles.container}>\n {leftVisible && <LeftSidebar model={model} />}\n <div style={styles.centerArea}>\n <TitleBar model={model} />\n <PreviewArea model={model} />\n <BottomDebugPanel model={model} consoleStore={consoleEventsStore} />\n </div>\n {rightVisible && <RightSidebar model={model} />}\n </div>\n );\n }\n);\n","// src/AsyncStream.ts\nvar AsyncStream = class _AsyncStream {\n constructor(iterator) {\n this.iterator = iterator;\n }\n iterator;\n static fromIterable(fn) {\n return new _AsyncStream(fn[Symbol.asyncIterator]());\n }\n static fromFn(fn) {\n return new _AsyncStream(fn());\n }\n [Symbol.asyncIterator]() {\n return this.iterator;\n }\n};\nvar MediaResponse = class {\n constructor(mimeType, data) {\n this.mimeType = mimeType;\n this.data = data;\n }\n mimeType;\n data;\n};\n\nexport {\n AsyncStream,\n MediaResponse\n};\n//# sourceMappingURL=chunk-TTRCY65Z.mjs.map","import {\n AsyncStream\n} from \"./chunk-TTRCY65Z.mjs\";\n\n// src/client.ts\nvar ApiError = class extends Error {\n constructor(statusCode, method, message) {\n super(message);\n this.statusCode = statusCode;\n this.method = method;\n this.name = \"ApiError\";\n }\n statusCode;\n method;\n};\nvar ProxyApiClient = class {\n constructor(_request) {\n this._request = _request;\n }\n _request;\n _createProxy(prefix) {\n return new Proxy(() => {\n }, {\n apply: async (_target, _self, args) => {\n const result = await this._request(prefix, args[0]);\n return result;\n },\n get: (_target, prop) => {\n if (typeof prop === \"symbol\") {\n return void 0;\n }\n if (prop === \"then\" || prop === \"catch\" || prop === \"finally\" || prop === \"toString\" || prop === \"valueOf\" || prop === \"toJSON\" || prop === \"name\" || prop === \"length\" || prop === \"prototype\" || prop === \"constructor\" || prop === \"caller\" || prop === \"arguments\") {\n return void 0;\n }\n return this._createProxy(`${prefix}${prefix ? \"/\" : \"\"}${prop}`);\n }\n });\n }\n methods = this._createProxy(\"\");\n};\nfunction createFetchClient(baseUrl, options) {\n return new ProxyApiClient(async (method, arg) => {\n const result = await fetch(`${baseUrl}/${method}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.getHeaders?.()\n },\n body: JSON.stringify(arg)\n });\n if (result.status !== 200) {\n const data2 = await result.json().catch(() => null);\n let message;\n if (data2 && typeof data2 === \"object\" && (\"errorMessage\" in data2 || \"error\" in data2)) {\n const msg = data2.errorMessage ?? data2.error;\n const stack = data2.stack;\n message = `${msg}${stack ? `\n${stack}` : \"\"}`;\n } else {\n message = `Error calling API method \"${method}\" (${result.status}): ${JSON.stringify(data2)}`;\n }\n const error = new ApiError(result.status, method, message);\n options?.onError?.(error);\n throw error;\n }\n const contentType = result.headers.get(\"Content-Type\");\n if (contentType?.startsWith(\"application/jsonl\")) {\n return AsyncStream.fromFn(async function* () {\n const reader = result.body?.getReader();\n if (!reader) {\n return;\n }\n let buffer = \"\";\n const decoder = new TextDecoder(\"utf-8\");\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n buffer += decoder.decode(value, { stream: true });\n let eolIndex;\n while ((eolIndex = buffer.indexOf(\"\\n\")) >= 0) {\n const line = buffer.slice(0, eolIndex).trim();\n buffer = buffer.slice(eolIndex + 1);\n if (line.length > 0) {\n yield JSON.parse(line);\n }\n }\n }\n const finalLine = buffer.trim();\n if (finalLine.length > 0) {\n yield JSON.parse(finalLine);\n }\n });\n }\n const data = await result.json();\n return data;\n });\n}\nfunction createLocalClient(api, context) {\n return new ProxyApiClient(async (method, args) => {\n return await api.run(method, args, context);\n });\n}\n\nexport {\n ApiError,\n ProxyApiClient,\n createFetchClient,\n createLocalClient\n};\n//# sourceMappingURL=chunk-WNXMRXWV.mjs.map","import { observableValue, type IObservable } from '@vscode/observables';\nimport { createFetchClient, type ProxyApiClient } from '@hediet/simple-api/client';\nimport { SemanticVersion } from 'semver';\nimport {\n type DaemonApiType,\n type DaemonEvent,\n} from '@vscode/component-explorer-cli/daemon-types';\nimport type { DaemonConfig } from './DaemonConfig.js';\nimport { runtimeVersion } from '../runtimeVersion.js';\n\n/** Screenshot result from the daemon */\nexport type DaemonScreenshotResult = DaemonApiType['screenshots']['take']['TResult'];\n\n/** Comparison result from the daemon */\nexport type DaemonCompareResult = DaemonApiType['screenshots']['compare']['TResult'];\n\n/** Fixture info from the daemon */\nexport type DaemonFixtureInfo = DaemonApiType['fixtures']['list']['TResult']['fixtures'][number];\n\nexport interface DaemonSession {\n\treadonly name: string;\n\treadonly serverUrl: string;\n\treadonly sourceKind: 'current' | 'worktree';\n}\n\ninterface CachedScreenshot {\n\treadonly sourceTreeId: string;\n\treadonly data: DaemonScreenshotResult;\n}\n\n/**\n * Client-side model for interacting with the daemon.\n * Manages source tree IDs, screenshot caching, and the event stream.\n */\nexport class DaemonModel {\n\tprivate readonly _sourceTreeIds = observableValue<ReadonlyMap<string, string>>(this, new Map());\n\tprivate readonly _sessions = observableValue<readonly DaemonSession[]>(this, []);\n\tprivate readonly _screenshotCache = new Map<string, CachedScreenshot>();\n\tprivate readonly _client: ProxyApiClient<DaemonApiType>;\n\tprivate _eventStreamAbort: AbortController | null = null;\n\n\treadonly sessionName: string;\n\n\t/** Observable map of sessionName → current sourceTreeId */\n\treadonly sourceTreeIds: IObservable<ReadonlyMap<string, string>> = this._sourceTreeIds;\n\n\t/** Observable list of sessions from the daemon */\n\treadonly sessions: IObservable<readonly DaemonSession[]> = this._sessions;\n\n\tconstructor(readonly config: DaemonConfig) {\n\t\tthis.sessionName = config.sessionName;\n\t\tthis._client = createFetchClient<DaemonApiType>('/__explorer/daemon-api', {\n\t\t\tgetHeaders: () => ({ 'X-Client-Name': 'explorer-ui' }),\n\t\t});\n\t}\n\n\t/**\n\t * Initializes the model: fetches initial session info and starts listening to events.\n\t * Call this once after construction.\n\t */\n\tasync initialize(): Promise<void> {\n\t\tthis._validateProtocolVersions();\n\t\tawait this._fetchSessionInfos();\n\t\tthis._startEventStream();\n\t}\n\n\t/**\n\t * Get a screenshot for a fixture in a session, using cache when available.\n\t * Cache is keyed on sessionName + fixtureId and invalidated when sourceTreeId changes.\n\t */\n\tasync getScreenshot(sessionName: string, fixtureId: string): Promise<DaemonScreenshotResult> {\n\t\tconst sourceTreeId = this._sourceTreeIds.get().get(sessionName);\n\t\tif (!sourceTreeId) {\n\t\t\tthrow new Error(`No sourceTreeId known for session '${sessionName}'`);\n\t\t}\n\n\t\tconst cacheKey = `${sessionName}:${fixtureId}`;\n\t\tconst cached = this._screenshotCache.get(cacheKey);\n\t\tif (cached && cached.sourceTreeId === sourceTreeId) {\n\t\t\treturn cached.data;\n\t\t}\n\n\t\tconst result = await this._client.methods.screenshots.take({\n\t\t\tfixtureId,\n\t\t\tsessionName,\n\t\t\tsourceTreeId,\n\t\t\tincludeImage: true,\n\t\t});\n\n\t\tthis._screenshotCache.set(cacheKey, { sourceTreeId, data: result });\n\t\treturn result;\n\t}\n\n\t/**\n\t * Compare a fixture across two sessions. Returns match status and hashes (no images).\n\t */\n\tasync compare(fixtureId: string, baselineSessionName: string, currentSessionName: string): Promise<DaemonCompareResult> {\n\t\tconst baselineSourceTreeId = this._sourceTreeIds.get().get(baselineSessionName);\n\t\tconst currentSourceTreeId = this._sourceTreeIds.get().get(currentSessionName);\n\t\tif (!baselineSourceTreeId || !currentSourceTreeId) {\n\t\t\tthrow new Error(`Missing sourceTreeId for sessions`);\n\t\t}\n\t\treturn this._client.methods.screenshots.compare({\n\t\t\tfixtureId,\n\t\t\tbaselineSessionName,\n\t\t\tbaselineSourceTreeId,\n\t\t\tcurrentSessionName,\n\t\t\tcurrentSourceTreeId,\n\t\t\tincludeImages: false,\n\t\t});\n\t}\n\n\t/**\n\t * List fixtures from a session.\n\t */\n\tasync listFixtures(sessionName: string): Promise<readonly DaemonFixtureInfo[]> {\n\t\tconst sourceTreeId = this._sourceTreeIds.get().get(sessionName);\n\t\tif (!sourceTreeId) {\n\t\t\tthrow new Error(`No sourceTreeId known for session '${sessionName}'`);\n\t\t}\n\t\tconst result = await this._client.methods.fixtures.list({ sessionName, sourceTreeId });\n\t\treturn result.fixtures;\n\t}\n\n\t/**\n\t * Get the explorer URL for a different session (for session switching via full navigation).\n\t */\n\tgetSessionExplorerUrl(sessionName: string): string | undefined {\n\t\tconst session = this._sessions.get().find(s => s.name === sessionName);\n\t\tif (!session) return undefined;\n\t\treturn session.serverUrl + '/___explorer';\n\t}\n\n\tdispose(): void {\n\t\tthis._eventStreamAbort?.abort();\n\t\tthis._eventStreamAbort = null;\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Private\n\t// ---------------------------------------------------------------------------\n\n\tprivate async _fetchSessionInfos(): Promise<void> {\n\t\tconst sessions = await this._client.methods.sessions();\n\t\tconst map = new Map<string, string>();\n\t\tconst sessionList: DaemonSession[] = [];\n\t\tfor (const s of sessions) {\n\t\t\tif (s.isLoading) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tmap.set(s.name, s.sourceTreeId);\n\t\t\tsessionList.push({ name: s.name, serverUrl: s.serverUrl, sourceKind: s.sourceKind });\n\t\t}\n\t\tthis._sourceTreeIds.set(map, undefined);\n\t\tthis._sessions.set(sessionList, undefined);\n\t}\n\n\tprivate async _startEventStream(): Promise<void> {\n\t\tthis._eventStreamAbort = new AbortController();\n\t\tconst signal = this._eventStreamAbort.signal;\n\n\t\ttry {\n\t\t\tconst stream = await this._client.methods.events();\n\t\t\tfor await (const event of stream) {\n\t\t\t\tif (signal.aborted) break;\n\t\t\t\tthis._handleEvent(event as DaemonEvent);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!signal.aborted) {\n\t\t\t\tconsole.error('[DaemonModel] Event stream error:', e);\n\t\t\t\t// Reconnect after a delay\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (!signal.aborted) {\n\t\t\t\t\t\tthis._startEventStream();\n\t\t\t\t\t}\n\t\t\t\t}, 2000);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _handleEvent(event: DaemonEvent): void {\n\t\tif (event.type === 'source-change') {\n\t\t\t// Update sourceTreeId for the session\n\t\t\tconst current = new Map(this._sourceTreeIds.get());\n\t\t\tcurrent.set(event.sessionName, event.sourceTreeId);\n\t\t\tthis._sourceTreeIds.set(current, undefined);\n\n\t\t\t// Evict screenshot cache entries for this session\n\t\t\tfor (const key of this._screenshotCache.keys()) {\n\t\t\t\tif (key.startsWith(`${event.sessionName}:`)) {\n\t\t\t\t\tthis._screenshotCache.delete(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _validateProtocolVersions(): void {\n\t\tconst expectedDaemonApiVersion = SemanticVersion.parse('1.0.0');\n\t\tconst actualDaemonApiVersion = SemanticVersion.parse(this.config.daemonApiVersion);\n\t\tif (expectedDaemonApiVersion.major !== actualDaemonApiVersion.major || expectedDaemonApiVersion.minor !== actualDaemonApiVersion.minor) {\n\t\t\tthrow new Error(\n\t\t\t\t`Daemon API version mismatch. Explorer expects 1.0.0, daemon provides ${this.config.daemonApiVersion}. Update CLI, vite plugin, and explorer together.`,\n\t\t\t);\n\t\t}\n\n\t\tconst neededByPlugin = SemanticVersion.parse(this.config.runtimeVersionNeededByPlugin);\n\t\tif (neededByPlugin.major !== runtimeVersion.major || neededByPlugin.minor !== runtimeVersion.minor) {\n\t\t\tthrow new Error(\n\t\t\t\t`Explorer runtime version mismatch. Plugin requires ${this.config.runtimeVersionNeededByPlugin}, explorer provides ${runtimeVersion.toString()}. Reinstall dependencies to align plugin and explorer runtime versions.`,\n\t\t\t);\n\t\t}\n\t}\n}\n","import { IReader, observableValue } from '@vscode/observables';\nimport type { ScreenshotReport, ReportFixtureEntry } from './ScreenshotReport.js';\nimport type { ExplorerTreeNode } from '../components/types.js';\nimport { FixturePath } from '../core/FixturePath.js';\n\ntype ReportState =\n | { readonly status: 'loading' }\n | { readonly status: 'ready'; readonly report: ScreenshotReport }\n | { readonly status: 'error'; readonly message: string };\n\nexport class ReportModel {\n readonly state = observableValue<ReportState>(this, { status: 'loading' });\n\n private readonly _baseUrl: string;\n\n constructor(readonly reportUrl: string) {\n // Base URL = everything up to and including the last '/'\n const lastSlash = reportUrl.lastIndexOf('/');\n this._baseUrl = lastSlash >= 0 ? reportUrl.slice(0, lastSlash + 1) : '';\n this._fetch();\n }\n\n resolveScreenshotUrl(relativePath: string): string {\n return this._baseUrl + relativePath;\n }\n\n buildTree(reader: IReader): ExplorerTreeNode {\n const state = this.state.read(reader);\n if (state.status !== 'ready') {\n return { id: new FixturePath(''), name: 'Report', type: 'folder', children: [], labels: [] };\n }\n\n return buildTreeFromFixtureIds(state.report.fixtures);\n }\n\n private async _fetch(): Promise<void> {\n this.state.set({ status: 'loading' }, undefined);\n try {\n const response = await fetch(this.reportUrl);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n const report: ScreenshotReport = await response.json();\n this.state.set({ status: 'ready', report }, undefined);\n } catch (e) {\n this.state.set({ status: 'error', message: String(e) }, undefined);\n }\n }\n}\n\ninterface MutableTreeNode {\n id: FixturePath;\n name: string;\n type: 'folder' | 'component';\n children?: MutableTreeNode[];\n reportEntry?: ReportFixtureEntry;\n labels: string[];\n}\n\nfunction buildTreeFromFixtureIds(fixtures: { readonly [fixtureId: string]: ReportFixtureEntry | undefined }): ExplorerTreeNode {\n const root: MutableTreeNode = { id: new FixturePath(''), name: 'Components', type: 'folder', children: [], labels: [] };\n\n for (const [fixtureId, entry] of Object.entries(fixtures)) {\n const segments = new FixturePath(fixtureId).segments;\n let current = root;\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n const isLeaf = i === segments.length - 1;\n const childId = new FixturePath(segments.slice(0, i + 1).join('/'));\n\n if (isLeaf) {\n const labels = [...(entry?.labels ?? [])];\n if (entry?.status === 'changed' && !labels.includes('changed')) {\n labels.push('changed');\n }\n current.children!.push({\n id: childId,\n name: segment,\n type: 'component',\n reportEntry: entry,\n labels,\n });\n } else {\n let folder = current.children!.find(c => c.type === 'folder' && c.name === segment);\n if (!folder) {\n folder = { id: childId, name: segment, type: 'folder', children: [], labels: [] };\n current.children!.push(folder);\n }\n current = folder;\n }\n }\n }\n\n return root;\n}\n","import { createRoot } from 'react-dom/client';\nimport { createElement } from 'react';\nimport { FixtureRegistry, type FixtureExport, type FixtureModules, type ExplorerRuntime } from '../core/index.js';\nimport { Explorer } from '../components/index.js';\nimport { DaemonModel } from '../daemon/index.js';\nimport type { DaemonConfig } from '../daemon/DaemonConfig.js';\nimport { ReportModel } from '../report/index.js';\nimport { setExplorerShadowHost } from '../lib/explorerShadowHost.js';\n\nimport explorerCss from '../styles.css?inline';\nimport darkThemeCss from '../vscode-styles/default-dark-plus.css?inline';\nimport lightThemeCss from '../vscode-styles/default-light-plus.css?inline';\n\nexport class ExplorerUIMode implements ExplorerRuntime {\n\tprivate readonly _root: ReturnType<typeof createRoot>;\n\tprivate readonly _registry = new FixtureRegistry();\n\tprivate readonly _daemonModel?: DaemonModel;\n\tprivate readonly _reportModel?: ReportModel;\n\n\tconstructor(element: HTMLElement, loadFixtures: Promise<FixtureModules>, daemonConfig?: DaemonConfig) {\n\t\tthis._registry.loading.set(true, undefined);\n\t\tloadFixtures.then(\n\t\t\tmodules => {\n\t\t\t\tthis._populateRegistry(modules);\n\t\t\t\tthis._registry.loading.set(false, undefined);\n\t\t\t\tthis._registry.error.set(undefined, undefined);\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tconst message = error instanceof Error ? (error.stack ?? error.message) : String(error);\n\t\t\t\tthis._registry.loading.set(false, undefined);\n\t\t\t\tthis._registry.error.set(message, undefined);\n\t\t\t},\n\t\t);\n\t\tthis._reportModel = this._initializeReportModel();\n\t\tthis._daemonModel = this._reportModel ? undefined : this._initializeDaemonModel(daemonConfig);\n\n\t\tconst shadow = element.attachShadow({ mode: 'open' });\n\t\tconst sheet = new CSSStyleSheet();\n\t\tsheet.replaceSync([\n\t\t\texplorerCss,\n\t\t\tdarkThemeCss,\n\t\t\tlightThemeCss,\n\t\t].join('\\n'));\n\t\tshadow.adoptedStyleSheets = [sheet];\n\n\t\tsetExplorerShadowHost(element);\n\n\t\tconst uiContainer = document.createElement('div');\n\t\tuiContainer.style.height = '100%';\n\t\tuiContainer.style.width = '100%';\n\t\tshadow.appendChild(uiContainer);\n\n\t\tthis._root = createRoot(uiContainer);\n\t\tthis._root.render(createElement(Explorer, {\n\t\t\tregistry: this._registry,\n\t\t\tdaemonModel: this._daemonModel,\n\t\t\treportModel: this._reportModel,\n\t\t}));\n\t}\n\n\tprivate _initializeReportModel(): ReportModel | undefined {\n\t\tconst params = new URLSearchParams(location.search);\n\t\tconst reportUrl = params.get('report');\n\t\tif (!reportUrl) return undefined;\n\t\treturn new ReportModel(reportUrl);\n\t}\n\n\tprivate _initializeDaemonModel(daemonConfig: DaemonConfig | undefined): DaemonModel | undefined {\n\t\tif (!daemonConfig) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst model = new DaemonModel(daemonConfig);\n\t\tmodel.initialize().catch(err => {\n\t\t\tconsole.error('[ExplorerUIMode] Failed to initialize DaemonModel:', err);\n\t\t});\n\t\treturn model;\n\t}\n\n\tprivate _populateRegistry(fixtureModules: FixtureModules): void {\n\t\tthis._registry.clear();\n\t\tfor (const [path, module] of Object.entries(fixtureModules)) {\n\t\t\tconst fixture = module.default;\n\t\t\tif (fixture && typeof fixture === 'object') {\n\t\t\t\tthis._registry.register(path, fixture as FixtureExport);\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateFixtures(fixtureModules: FixtureModules): void {\n\t\tthis._populateRegistry(fixtureModules);\n\t\tthis._registry.loading.set(false, undefined);\n\t\tthis._registry.error.set(undefined, undefined);\n\t}\n\n\tbumpVersion(): void {}\n\n\tdispose(): void {\n\t\tthis._daemonModel?.dispose();\n\t\tthis._root.unmount();\n\t}\n}\n","import type { FixtureNode } from '../core/FixtureNode.js';\nimport type { FixtureExport } from '../core/fixtureApi.js';\nimport type { DisposeReport, ExceptionError, RenderEvent, RenderReport } from '../core/ErrorInfo.js';\nimport type { ExplorerRuntime, FixtureModules } from '../core/index.js';\nimport type { HeadlessApi, HeadlessFlatFixture, IComponentExplorerGlobal } from '@vscode/component-explorer-common';\nimport { createFixtureTree } from '../core/FixtureNode.js';\nimport { ComponentRendering } from '../core/ComponentRenderer.js';\nimport { runtimeVersion } from '../runtimeVersion.js';\n\ndeclare global {\n\tinterface Window extends IComponentExplorerGlobal { }\n}\n\nexport class HeadlessMode implements ExplorerRuntime {\n\t/** Random ID generated on construction — changes on full page reload. */\n\treadonly pageInstanceId = Math.random().toString(36).slice(2);\n\tprivate _updateVersion = 0;\n\tprivate _root: FixtureNode;\n\tprivate _fixtureModules: FixtureModules;\n\tprivate _loadError: string | undefined;\n\tprivate _loadPromise: Promise<void>;\n\tprivate _currentRendering: ComponentRendering | undefined;\n\tprivate _currentContainer: HTMLElement | undefined;\n\n\tconstructor(\n\t\tprivate readonly _containerElement: HTMLElement,\n\t\tloadFixtures: Promise<FixtureModules>,\n\t) {\n\t\tthis._fixtureModules = {};\n\t\tthis._root = this._buildTree(this._fixtureModules);\n\t\tthis._loadPromise = loadFixtures.then(\n\t\t\tmodules => {\n\t\t\t\tthis._fixtureModules = modules;\n\t\t\t\tthis._root = this._buildTree(modules);\n\t\t\t\tthis._loadError = undefined;\n\t\t\t\tthis._updateVersion++;\n\t\t\t\tconst count = this._flattenFixtures(this._root).length;\n\t\t\t\tconsole.log('[headless] Fixtures loaded, version:', this._updateVersion, 'fixtures:', count);\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tthis._loadError = error instanceof Error ? (error.stack ?? error.message) : String(error);\n\t\t\t\tthis._updateVersion++;\n\t\t\t\tconsole.error('[headless] Failed to load fixtures:', this._loadError);\n\t\t\t},\n\t\t);\n\t\tthis._installGlobalApi();\n\n\t\tconsole.log('[headless] Initialized, pageInstanceId:', this.pageInstanceId);\n\t}\n\n\tget updateVersion(): number {\n\t\treturn this._updateVersion;\n\t}\n\n\tupdateFixtures(fixtureModules: FixtureModules): void {\n\t\tthis._fixtureModules = fixtureModules;\n\t\tthis._root = this._buildTree(fixtureModules);\n\t\tthis._loadError = undefined;\n\t\tthis._updateVersion++;\n\t\tconst count = this._flattenFixtures(this._root).length;\n\t\tconsole.log('[headless] Registry rebuilt, version:', this._updateVersion, 'fixtures:', count);\n\t}\n\n\tbumpVersion(): void {\n\t\tthis._updateVersion++;\n\t\tconsole.log('[headless] Version bumped:', this._updateVersion);\n\t}\n\n\tasync listFixtures(): Promise<HeadlessFlatFixture[]> {\n\t\tawait this._loadPromise;\n\t\tif (this._loadError) {\n\t\t\tthrow new Error(this._loadError);\n\t\t}\n\t\treturn this._flattenFixtures(this._root);\n\t}\n\n\tasync disposeCurrentFixture(): Promise<DisposeReport> {\n\t\tconst events: RenderEvent[] = [];\n\t\tconst errors: ExceptionError[] = [];\n\t\tconst stop = this._captureEvents(events);\n\t\ttry {\n\t\t\tif (this._currentRendering) {\n\t\t\t\tconst r = this._currentRendering;\n\t\t\t\tthis._currentRendering = undefined;\n\t\t\t\ttry {\n\t\t\t\t\tconst disposeErrors = await r.dispose();\n\t\t\t\t\terrors.push(...disposeErrors);\n\t\t\t\t} catch (e) {\n\t\t\t\t\terrors.push(this._toError(e));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._currentContainer) {\n\t\t\t\ttry {\n\t\t\t\t\tthis._currentContainer.remove();\n\t\t\t\t} catch (e) {\n\t\t\t\t\terrors.push(this._toError(e));\n\t\t\t\t}\n\t\t\t\tthis._currentContainer = undefined;\n\t\t\t}\n\t\t\t// Give one frame for unhandled rejections / async window errors\n\t\t\t// triggered during dispose to surface before we stop capturing.\n\t\t\tawait new Promise<void>(resolve => requestAnimationFrame(() => resolve()));\n\t\t} finally {\n\t\t\tstop();\n\t\t}\n\t\tconst hasError = errors.length > 0 || events.some(e => e.type === 'console.error' || e.type === 'window.error' || e.type === 'window.unhandledrejection');\n\t\treturn { hasError, errors, events };\n\t}\n\n\tasync renderFixture(fixtureId: string, input?: unknown): Promise<RenderReport> {\n\t\tawait this._loadPromise;\n\t\tif (this._loadError) {\n\t\t\tthrow new Error(this._loadError);\n\t\t}\n\t\tconst node = this._findFixtureNode(this._root, fixtureId);\n\t\tif (!node || !node.component) {\n\t\t\tconst allIds = this._flattenFixtures(this._root).map(f => f.fixtureId);\n\t\t\tconst suggestions = findClosestMatches(fixtureId, allIds, 5);\n\t\t\tconst suggestionText = suggestions.length > 0\n\t\t\t\t? `\\nDid you mean one of these?\\n${suggestions.map(s => ` - ${s}`).join('\\n')}`\n\t\t\t\t: '';\n\t\t\tthrow new Error('Fixture not found: ' + fixtureId + suggestionText);\n\t\t}\n\n\t\tif (input !== undefined && (typeof input !== 'object' || input === null || Array.isArray(input))) {\n\t\t\tthrow new Error(\n\t\t\t\t`Fixture input must be a JSON object (or undefined) — received ${input === null ? 'null' : Array.isArray(input) ? 'an array' : typeof input\n\t\t\t\t}.`,\n\t\t\t);\n\t\t}\n\n\t\tconst previousDisposeReport = await this.disposeCurrentFixture();\n\n\t\tconst container = document.createElement('div');\n\t\tcontainer.style.display = 'inline-block';\n\t\tthis._containerElement.appendChild(container);\n\t\tthis._currentContainer = container;\n\n\t\tconst def = node.component;\n\n\t\tconst events: RenderEvent[] = [];\n\t\tlet error: ExceptionError | undefined;\n\n\t\tconst setError = (e: ExceptionError) => {\n\t\t\tif (!error) { error = e; }\n\t\t};\n\n\t\tconst stop = this._captureEvents(events);\n\n\t\tlet output: unknown;\n\t\tconst startTime = performance.now();\n\t\tlet syncTimeMs: number | undefined;\n\t\ttry {\n\t\t\tconst rendering = new ComponentRendering(container, def, { kind: 'headless', interactive: false }, input);\n\t\t\tsyncTimeMs = performance.now() - startTime;\n\t\t\tthis._currentRendering = rendering;\n\n\t\t\tawait rendering.waitForRendering();\n\t\t\toutput = rendering.hasOutput ? rendering.getOutputSnapshot() : undefined;\n\t\t} catch (e) {\n\t\t\tsetError(this._toError(e));\n\t\t} finally {\n\t\t\tstop();\n\t\t}\n\n\t\tif (!error) {\n\t\t\tawait new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));\n\t\t}\n\n\t\tconst totalTimeMs = performance.now() - startTime;\n\n\t\tconst hasError = !!error || events.some(e => e.type !== 'console.log' && e.type !== 'console.warn');\n\t\tconst renderTimeMs = { sync: Math.round(syncTimeMs ?? totalTimeMs), total: Math.round(totalTimeMs) };\n\t\tconst previousDispose = (previousDisposeReport.hasError || previousDisposeReport.events.length > 0 || previousDisposeReport.errors.length > 0)\n\t\t\t? previousDisposeReport\n\t\t\t: undefined;\n\t\treturn { hasError, error, events, output, renderTimeMs, previousDispose };\n\t}\n\n\t/**\n\t * Install console + window error/rejection listeners that push into `events`.\n\t * Returns a `stop` function that uninstalls them. Listeners do not need to be\n\t * uninstalled in a `finally` ordering — multiple captures may overlap; the\n\t * outer `console.*` is restored to whatever was the previous value (LIFO via\n\t * the closure over `originalError` etc.).\n\t */\n\tprivate _captureEvents(events: RenderEvent[]): () => void {\n\t\tconst originalError = console.error;\n\t\tconst originalWarn = console.warn;\n\t\tconst originalLog = console.log;\n\t\tconst stackFromArgs = (args: unknown[]): string | undefined => {\n\t\t\tfor (const a of args) {\n\t\t\t\tif (a instanceof Error && a.stack) { return a.stack; }\n\t\t\t}\n\t\t\treturn undefined;\n\t\t};\n\t\tconsole.error = (...args: unknown[]) => {\n\t\t\tevents.push({ type: 'console.error', message: args.map(String).join(' '), stack: stackFromArgs(args) });\n\t\t\toriginalError.apply(console, args);\n\t\t};\n\t\tconsole.warn = (...args: unknown[]) => {\n\t\t\tevents.push({ type: 'console.warn', message: args.map(String).join(' '), stack: stackFromArgs(args) });\n\t\t\toriginalWarn.apply(console, args);\n\t\t};\n\t\tconsole.log = (...args: unknown[]) => {\n\t\t\tevents.push({ type: 'console.log', message: args.map(String).join(' ') });\n\t\t\toriginalLog.apply(console, args);\n\t\t};\n\t\tconst errorHandler = (event: ErrorEvent) => {\n\t\t\tevents.push({ type: 'window.error', message: event.message, stack: event.error?.stack });\n\t\t};\n\t\tconst rejectionHandler = (event: PromiseRejectionEvent) => {\n\t\t\tconst reason = event.reason;\n\t\t\tconst message = reason instanceof Error ? reason.message : String(reason);\n\t\t\tconst stack = reason instanceof Error ? reason.stack : undefined;\n\t\t\tevents.push({ type: 'window.unhandledrejection', message, stack });\n\t\t};\n\t\twindow.addEventListener('error', errorHandler);\n\t\twindow.addEventListener('unhandledrejection', rejectionHandler);\n\t\treturn () => {\n\t\t\tconsole.error = originalError;\n\t\t\tconsole.warn = originalWarn;\n\t\t\tconsole.log = originalLog;\n\t\t\twindow.removeEventListener('error', errorHandler);\n\t\t\twindow.removeEventListener('unhandledrejection', rejectionHandler);\n\t\t};\n\t}\n\n\tprivate _toError(e: unknown): ExceptionError {\n\t\tif (e instanceof Error) {\n\t\t\treturn { message: e.message, stack: e.stack };\n\t\t}\n\t\tif (e && typeof e === 'object' && 'message' in e) {\n\t\t\treturn {\n\t\t\t\tmessage: String((e as Record<string, unknown>).message),\n\t\t\t\tstack: String((e as Record<string, unknown>).stack ?? '') || undefined,\n\t\t\t};\n\t\t}\n\t\treturn { message: String(e) };\n\t}\n\n\tprivate _buildTree(fixtureModules: FixtureModules): FixtureNode {\n\t\tconst fixtures = new Map<string, FixtureExport>();\n\t\tfor (const [path, module] of Object.entries(fixtureModules)) {\n\t\t\tconst fixture = module.default;\n\t\t\tif (fixture && typeof fixture === 'object') {\n\t\t\t\tfixtures.set(path, fixture as FixtureExport);\n\t\t\t}\n\t\t}\n\t\treturn createFixtureTree(fixtures);\n\t}\n\n\tprivate _flattenFixtures(node: FixtureNode, groupPath: string[] = [], inheritedLabels: readonly string[] = []): HeadlessFlatFixture[] {\n\t\tconst effectiveLabels = inheritedLabels.length > 0 && node.labels.length > 0\n\t\t\t? [...new Set([...inheritedLabels, ...node.labels])]\n\t\t\t: node.labels.length > 0 ? [...node.labels]\n\t\t\t\t: [...inheritedLabels];\n\t\tconst results: HeadlessFlatFixture[] = [];\n\t\tif (node.type === 'component') {\n\t\t\tresults.push({\n\t\t\t\tfixtureId: node.id.value,\n\t\t\t\tfixtureName: node.name,\n\t\t\t\tgroupPath,\n\t\t\t\tbackground: node.component?.background ?? 'light',\n\t\t\t\tlabels: effectiveLabels,\n\t\t\t\texpectedVisualDescriptions: node.component?.expectedVisualDescriptions ?? [],\n\t\t\t\tinputSchema: node.component?.inputSchema,\n\t\t\t});\n\t\t}\n\t\tfor (const child of node.children ?? []) {\n\t\t\tconst nextPath = node.id.value ? [...groupPath, node.name] : groupPath;\n\t\t\tresults.push(...this._flattenFixtures(child, nextPath, effectiveLabels));\n\t\t}\n\t\treturn results;\n\t}\n\n\tprivate _findFixtureNode(node: FixtureNode, fixtureId: string): FixtureNode | undefined {\n\t\tif (node.id.value === fixtureId) return node;\n\t\tfor (const child of node.children ?? []) {\n\t\t\tconst found = this._findFixtureNode(child, fixtureId);\n\t\t\tif (found) return found;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate _installGlobalApi(): void {\n\t\tconst self = this;\n\t\tconst api: HeadlessApi = {\n\t\t\tpageInstanceId: this.pageInstanceId,\n\t\t\tget updateVersion() { return self._updateVersion; },\n\t\t\truntimeVersion: runtimeVersion.toString(),\n\t\t\tlistFixtures: () => this.listFixtures(),\n\t\t\trenderFixture: (id, input) => this.renderFixture(id, input),\n\t\t\tdisposeCurrentFixture: () => this.disposeCurrentFixture(),\n\t\t};\n\t\twindow.__componentExplorer__ = api;\n\t}\n}\n\nfunction levenshteinDistance(a: string, b: string): number {\n\tconst la = a.length, lb = b.length;\n\tconst dp = Array.from({ length: la + 1 }, () => new Array<number>(lb + 1));\n\tfor (let i = 0; i <= la; i++) dp[i][0] = i;\n\tfor (let j = 0; j <= lb; j++) dp[0][j] = j;\n\tfor (let i = 1; i <= la; i++) {\n\t\tfor (let j = 1; j <= lb; j++) {\n\t\t\tdp[i][j] = a[i - 1] === b[j - 1]\n\t\t\t\t? dp[i - 1][j - 1]\n\t\t\t\t: 1 + Math.min(dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]);\n\t\t}\n\t}\n\treturn dp[la][lb];\n}\n\nfunction findClosestMatches(target: string, candidates: string[], count: number): string[] {\n\treturn candidates\n\t\t.map(c => ({ id: c, dist: levenshteinDistance(target.toLowerCase(), c.toLowerCase()) }))\n\t\t.sort((a, b) => a.dist - b.dist)\n\t\t.slice(0, count)\n\t\t.map(c => c.id);\n}\n","import type { FixtureExport, RenderHost } from '../core/fixtureApi.js';\nimport type { FixtureNode } from '../core/FixtureNode.js';\nimport type { ExplorerRuntime, FixtureModules } from '../core/index.js';\nimport type { ExceptionError, RenderEventType } from '../core/ErrorInfo.js';\nimport { createFixtureTree } from '../core/FixtureNode.js';\nimport { ComponentRendering } from '../core/ComponentRenderer.js';\nimport type { ActiveDebugPanelSession } from '../core/FixtureInteractionRuntime.js';\n\ninterface DebugPanelRequest {\n\tprivateSession?: ActiveDebugPanelSession;\n\treadonly panelId: string;\n}\n\nexport class EmbeddedMode implements ExplorerRuntime {\n\tprivate _root: FixtureNode | undefined;\n\tprivate _rendering: ComponentRendering | undefined;\n\tprivate _resizeObserver: ResizeObserver | undefined;\n\tprivate _errorPosted = false;\n\tprivate _originalConsoleError: typeof console.error | undefined;\n\tprivate _originalConsoleWarn: typeof console.warn | undefined;\n\tprivate readonly _debugPanelRequests = new Map<string, DebugPanelRequest>();\n\tprivate _input: unknown;\n\tprivate _renderHost: RenderHost = { kind: 'embedded', interactive: false };\n\tprivate _initialized = window.parent === window;\n\n\tconstructor(\n\t\tprivate readonly _container: HTMLElement,\n\t\tprivate readonly _fixtureId: string,\n\t\tloadSourceModule: Promise<FixtureModules>,\n\t) {\n\t\tthis._setupErrorCapture();\n\t\tthis._setupDebugPanelTransport();\n\t\tloadSourceModule.then(\n\t\t\tmodules => {\n\t\t\t\tthis._root = this._buildTree(modules);\n\t\t\t\tif (this._initialized) {\n\t\t\t\t\tthis._render();\n\t\t\t\t}\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tconst message = error instanceof Error ? (error.stack ?? error.message) : String(error);\n\t\t\t\tconsole.error('[EmbeddedMode] Failed to load fixtures:', message);\n\t\t\t\tthis._container.innerHTML = '';\n\t\t\t\tconst el = document.createElement('div');\n\t\t\t\tel.style.cssText = 'padding:16px;color:#f44;font-size:13px;font-family:monospace;white-space:pre-wrap;user-select:text;cursor:text;';\n\t\t\t\tel.textContent = `Failed to load fixture:\\n${message}`;\n\t\t\t\tthis._container.appendChild(el);\n\t\t\t\tthis._postError({ message: error instanceof Error ? error.message : String(error), stack: error instanceof Error ? error.stack : undefined });\n\t\t\t},\n\t\t);\n\t\tif (!this._initialized) {\n\t\t\twindow.parent.postMessage({ type: 'component-explorer:embedded-loaded' }, '*');\n\t\t}\n\t}\n\n\tprivate _setupDebugPanelTransport(): void {\n\t\twindow.addEventListener('message', event => {\n\t\t\tif (event.source !== window.parent) return;\n\t\t\tconst data = event.data;\n\t\t\tif (data?.type === 'component-explorer:embedded-init') {\n\t\t\t\tif (this._initialized) return;\n\t\t\t\tthis._initialized = true;\n\t\t\t\tthis._input = data.input;\n\t\t\t\tthis._renderHost = data.host?.kind === 'explorer-ui'\n\t\t\t\t\t? { kind: 'explorer-ui', interactive: true }\n\t\t\t\t\t: { kind: 'embedded', interactive: false };\n\t\t\t\tif (this._root) {\n\t\t\t\t\tthis._render();\n\t\t\t\t}\n\t\t\t} else if (data?.type === 'component-explorer:embedded-input') {\n\t\t\t\tthis._updateInput(data.input);\n\t\t\t} else if (data?.type === 'component-explorer:debug-panel-activate') {\n\t\t\t\tconst sessionId = typeof data.sessionId === 'string' ? data.sessionId : '';\n\t\t\t\tconst panelId = typeof data.panelId === 'string' ? data.panelId : '';\n\t\t\t\tif (!sessionId || !panelId) return;\n\t\t\t\tconst previous = this._debugPanelRequests.get(sessionId);\n\t\t\t\tprevious?.privateSession?.dispose();\n\t\t\t\tconst request: DebugPanelRequest = { panelId };\n\t\t\t\tthis._debugPanelRequests.set(sessionId, request);\n\t\t\t\tthis._activateDebugPanel(sessionId, request);\n\t\t\t} else if (data?.type === 'component-explorer:debug-panel-action') {\n\t\t\t\tconst sessionId = typeof data.sessionId === 'string' ? data.sessionId : '';\n\t\t\t\tthis._debugPanelRequests.get(sessionId)?.privateSession?.sendAction(data.action);\n\t\t\t} else if (data?.type === 'component-explorer:debug-panel-deactivate') {\n\t\t\t\tconst sessionId = typeof data.sessionId === 'string' ? data.sessionId : '';\n\t\t\t\tconst request = this._debugPanelRequests.get(sessionId);\n\t\t\t\trequest?.privateSession?.dispose();\n\t\t\t\tthis._debugPanelRequests.delete(sessionId);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _updateInput(input: unknown): void {\n\t\tthis._input = input;\n\t\tif (!this._initialized || !this._rendering) return;\n\t\tif (!this._rendering.updateInput(input)) {\n\t\t\tthis._render();\n\t\t}\n\t}\n\n\tprivate _setupErrorCapture(): void {\n\t\t// Intercept console.error and forward to parent\n\t\tthis._originalConsoleError = console.error;\n\t\tconsole.error = (...args: unknown[]) => {\n\t\t\tthis._postConsoleEvent('console.error', args.map(String).join(' '));\n\t\t\tthis._originalConsoleError!.apply(console, args);\n\t\t};\n\n\t\t// Intercept console.warn and forward to parent\n\t\tthis._originalConsoleWarn = console.warn;\n\t\tconsole.warn = (...args: unknown[]) => {\n\t\t\tthis._postConsoleEvent('console.warn', args.map(String).join(' '));\n\t\t\tthis._originalConsoleWarn!.apply(console, args);\n\t\t};\n\n\t\twindow.addEventListener('error', (event) => {\n\t\t\tthis._postError({ message: event.message, stack: event.error?.stack });\n\t\t\tthis._postConsoleEvent('window.error', event.message, event.error?.stack);\n\t\t});\n\t\twindow.addEventListener('unhandledrejection', (event) => {\n\t\t\tconst reason = event.reason;\n\t\t\tconst message = reason instanceof Error ? reason.message : String(reason);\n\t\t\tconst stack = reason instanceof Error ? reason.stack : undefined;\n\t\t\tthis._postError({ message, stack });\n\t\t\tthis._postConsoleEvent('window.unhandledrejection', message, stack);\n\t\t});\n\t}\n\n\tprivate _postConsoleEvent(type: RenderEventType, message: string, stack?: string): void {\n\t\twindow.parent.postMessage({\n\t\t\ttype: 'component-explorer:console',\n\t\t\teventType: type,\n\t\t\tmessage,\n\t\t\tstack,\n\t\t}, '*');\n\t}\n\n\tprivate _postError(error: ExceptionError): void {\n\t\tif (this._errorPosted) return;\n\t\tthis._errorPosted = true;\n\t\twindow.parent.postMessage({\n\t\t\ttype: 'component-explorer:error',\n\t\t\tfixtureId: this._fixtureId,\n\t\t\terror,\n\t\t}, '*');\n\t}\n\n\tupdateFixtures(fixtureModules: FixtureModules): void {\n\t\tthis._root = this._buildTree(fixtureModules);\n\t\tthis._render();\n\t}\n\n\tbumpVersion(): void {\n\t\tthis._render();\n\t}\n\n\tprivate _render(): void {\n\t\t// Fire-and-forget — embedded mode has no dispose-report consumer.\n\t\tthis._rendering?.dispose().catch(() => { /* noop */ });\n\t\tthis._rendering = undefined;\n\t\tthis._resizeObserver?.disconnect();\n\t\tthis._resizeObserver = undefined;\n\t\tfor (const request of this._debugPanelRequests.values()) {\n\t\t\trequest.privateSession?.dispose();\n\t\t\trequest.privateSession = undefined;\n\t\t}\n\t\tthis._container.innerHTML = '';\n\n\t\tif (!this._root) return;\n\n\t\tconst node = this._findNode(this._root, this._fixtureId);\n\t\tif (!node?.component) {\n\t\t\tconsole.error(`[EmbeddedMode] Fixture not found: ${this._fixtureId}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst component = { ...node.component, isolation: 'none' as const };\n\t\tthis._errorPosted = false;\n\n\t\t// For component mode, make the container fit-content so the component's\n\t\t// natural width is measured (not constrained to the iframe viewport width).\n\t\tthis._container.style.width = component.displayMode.type === 'component' ? 'fit-content' : '';\n\n\t\ttry {\n\t\t\tconst rendering = new ComponentRendering(this._container, component, this._renderHost, this._input);\n\t\t\tthis._rendering = rendering;\n\n\t\t\trendering.waitForRendering().then(() => {\n\t\t\t\twindow.parent.postMessage({\n\t\t\t\t\ttype: 'component-explorer:ready',\n\t\t\t\t\tfixtureId: this._fixtureId,\n\t\t\t\t\thasOutput: rendering.hasOutput,\n\t\t\t\t\toutputEditable: rendering.outputEditable,\n\t\t\t\t}, '*');\n\t\t\t\tfor (const [sessionId, request] of this._debugPanelRequests) {\n\t\t\t\t\tthis._activateDebugPanel(sessionId, request);\n\t\t\t\t}\n\t\t\t}).catch((err) => {\n\t\t\t\t\tif (err && typeof err === 'object' && 'message' in err) {\n\t\t\t\t\t\tthis._postError(err as ExceptionError);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._postError({ message: err instanceof Error ? err.message : String(err), stack: err instanceof Error ? err.stack : undefined });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t} catch (err) {\n\t\t\t// Catch sync errors thrown during render\n\t\t\tthis._postError({ message: err instanceof Error ? err.message : String(err), stack: err instanceof Error ? err.stack : undefined });\n\t\t\tconsole.error('[EmbeddedMode] Error during rendering:', err);\n\t\t\treturn;\n\t\t}\n\n\t\tconst rendering = this._rendering;\n\t\tconst fixtureId = this._fixtureId;\n\t\tconst postSize = () => {\n\t\t\tconst rect = rendering.renderTarget.getBoundingClientRect();\n\t\t\twindow.parent.postMessage({\n\t\t\t\ttype: 'component-explorer:resize',\n\t\t\t\tfixtureId,\n\t\t\t\twidth: rect.width,\n\t\t\t\theight: rect.height,\n\t\t\t}, '*');\n\t\t};\n\n\t\tthis._resizeObserver = new ResizeObserver(postSize);\n\t\tthis._resizeObserver.observe(rendering.renderTarget);\n\t}\n\n\tprivate _activateDebugPanel(sessionId: string, request: DebugPanelRequest): void {\n\t\tif (!this._rendering || request.privateSession) return;\n\t\ttry {\n\t\t\trequest.privateSession = this._rendering.activateDebugPanel(\n\t\t\t\trequest.panelId,\n\t\t\t\tstate => window.parent.postMessage({\n\t\t\t\t\ttype: 'component-explorer:debug-panel-state',\n\t\t\t\t\tsessionId,\n\t\t\t\t\tstate,\n\t\t\t\t}, '*'),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis._postConsoleEvent(\n\t\t\t\t'console.error',\n\t\t\t\t`Failed to activate debug panel \"${request.panelId}\": ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\terror instanceof Error ? error.stack : undefined,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate _buildTree(fixtureModules: FixtureModules): FixtureNode {\n\t\tconst fixtures = new Map<string, FixtureExport>();\n\t\tfor (const [path, module] of Object.entries(fixtureModules)) {\n\t\t\tconst fixture = module.default;\n\t\t\tif (fixture && typeof fixture === 'object') {\n\t\t\t\tfixtures.set(path, fixture as FixtureExport);\n\t\t\t}\n\t\t}\n\t\treturn createFixtureTree(fixtures);\n\t}\n\n\tprivate _findNode(node: FixtureNode, id: string): FixtureNode | undefined {\n\t\tif (node.id.value === id) return node;\n\t\tfor (const child of node.children ?? []) {\n\t\t\tconst found = this._findNode(child, id);\n\t\t\tif (found) return found;\n\t\t}\n\t\treturn undefined;\n\t}\n}\n","import type { ExplorerQueryParams } from '@vscode/component-explorer-common';\nexport type { ExplorerMode, ExplorerQueryParams } from '@vscode/component-explorer-common';\n\nexport function parseExplorerQueryParams(params: URLSearchParams): ExplorerQueryParams {\n const mode = params.get('mode');\n return {\n mode: mode === 'headless' || mode === 'embedded' ? mode : undefined,\n fixture: params.get('fixture') ?? undefined,\n file: params.get('file') ?? undefined,\n report: params.get('report') ?? undefined,\n };\n}\n\nexport function toUrlSearchParams(query: ExplorerQueryParams): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) params.set(key, String(value));\n }\n return params;\n}\n","/**\n * Viewer entry point\n * \n * This module exports everything needed by the Component Explorer viewer.\n * Projects should NOT import from this module - use '@vscode/component-explorer' instead.\n */\n\nexport * from './core/index.js';\n\nexport type {\n FixtureExport,\n SingleFixtureExport,\n FixtureGroupExport,\n FixtureVariantsExport,\n} from './core/fixtureApi.js';\n\nimport { type FixtureModules, type ExplorerRuntime } from './core/index.js';\nimport { ExplorerUIMode } from './modes/ExplorerUIMode.js';\nimport { HeadlessMode } from './modes/HeadlessMode.js';\nimport { EmbeddedMode } from './modes/EmbeddedMode.js';\nimport { parseExplorerQueryParams, type ExplorerQueryParams } from './lib/explorerQueryParams.js';\nimport type { DaemonConfig } from './daemon/DaemonConfig.js';\n\nexport type { ExplorerMode, ExplorerQueryParams } from './lib/explorerQueryParams.js';\n\n// Main exports\nexport { Explorer, ExplorerModel } from './components/index.js';\nexport type { ExplorerTreeNode } from './components/index.js';\nexport { toExplorerTree } from './components/index.js';\n\n// Sub-components\nexport {\n TitleBar,\n TitleBarButton,\n LeftSidebar,\n RightSidebar,\n TreeView,\n TreeItem,\n} from './components/index.js';\n\n// Icons\nexport * from './components/icons.js';\n\n// Styles utilities\nexport { styles, mergeStyles } from './components/index.js';\n\n// Daemon exports\nexport { DaemonModel } from './daemon/index.js';\nexport type { DaemonScreenshotResult, DaemonCompareResult, DaemonFixtureInfo } from './daemon/DaemonModel.js';\n\n// Report exports\nexport { ReportModel } from './report/index.js';\nexport type { ScreenshotReport, ReportFixtureEntry, ReportSummary, FixtureStatus } from './report/index.js';\n\nexport interface ExplorerAppOptions {\n readonly loadFixtures: (filter?: { file: string }) => Promise<FixtureModules>;\n readonly daemonConfig?: DaemonConfig;\n}\n\nexport class ExplorerApp implements ExplorerRuntime {\n private readonly _runtime: ExplorerRuntime;\n\n constructor(element: HTMLElement, options: ExplorerAppOptions) {\n const buildInfo = globalThis._buildInfo;\n if (buildInfo) {\n console.log(`[component-explorer] v${buildInfo.version} (built ${buildInfo.date})`);\n }\n\n const params = new URLSearchParams(location.search);\n const query: ExplorerQueryParams = parseExplorerQueryParams(params);\n const fixtureId = query.fixture;\n\n if (query.mode === 'embedded') {\n if (!fixtureId) {\n throw new Error('Embedded mode requires a fixture query parameter');\n }\n const file = query.file;\n const fixtures = options.loadFixtures(file ? { file } : undefined);\n this._runtime = new EmbeddedMode(element, fixtureId, fixtures);\n } else {\n const fixturesPromise = options.loadFixtures();\n this._runtime = query.mode === 'headless'\n ? new HeadlessMode(element, fixturesPromise)\n : new ExplorerUIMode(element, fixturesPromise, options.daemonConfig);\n }\n }\n\n updateFixtures(fixtureModules: FixtureModules): void {\n this._runtime.updateFixtures(fixtureModules);\n }\n\n bumpVersion(): void {\n this._runtime.bumpVersion();\n }\n}\n"],"names":["isSingleFixture","value","singleFixtureBrand","isFixtureGroup","fixtureGroupBrand","isFixtureVariants","fixtureVariantsBrand","parseFixtureExport","parseSingleFixture","parseFixtureGroup","parseFixtureVariants","createComponentDefinition","fixture","id","name","sourceFile","inheritedVisualDescriptions","inheritedInputSchema","options","ownDescriptions","expectedVisualDescriptions","mergeInputSchemas","parent","child","properties","required","applyInputDefaults","schema","input","overrides","result","key","prop","isComponentDefinition","globalObservableLogger","addLogger","logger","ComposedLogger","getLogger","globalObservableLoggerFn","setLogObservableFn","fn","logObservable","obs","loggers","observable","location","newCount","info","autorun","change","derived","transaction","DebugLocation","enabled","enable","ofCaller","ofNthCaller","n","Err","l","stack","DebugLocationImpl","parentIdx","lines","parseLine","fileName","line","column","stackLine","match","match2","DebugNameData","owner","debugNameSource","referenceFn","target","getDebugName","countPerName","cachedDebugName","data","cached","dbgName","computeDebugName","count","self","ownerStr","formatOwner","getFunctionName","findKey","obj","countPerClassName","ownerId","className","getClassName","ctor","fnSrc","_derived","_setDerivedOpts","_recomputeInitiallyAndOnChange","_setRecomputeInitiallyAndOnChange","recomputeInitiallyAndOnChange","_keepObserved","_setKeepObserved","keepObserved","_debugGetDependencyGraph","_setDebugGetDependencyGraph","debugGetDependencyGraph","ConvenientObservable","reader","fnOrOwner","fnOrUndefined","debugLocation","store","handleValue","BaseObservable","_a","observer","len","deleted","hadLogger","toDisposable","BugIndicatingError","message","onBugIndicatingError","error","onUnexpectedError","strictEquals","a","b","DisposableStore","disposable","index","derivedStateToString","state","Derived","_debugNameData","_computeFn","_changeTracker","_handleLastObserverRemoved","_equalityComparator","d","_b","changeSummary","didChange","emptySet","_c","hadValue","oldValue","delayedStore","o","_d","e","r","_observable","propagateBeginUpdate","observers","shouldReact","wasUpToDate","shouldCallBeginUpdate","newValue","tx","computeFnOrOwner","computeFn","derivedOpts","derivedDisposable","computeFnOrUndefined","autorunStateToString","AutorunObserver","_runFn","createEffect","handleBugIndicatingErrorRecovery","err","TransactionImpl","subtransaction","_fn","_getDebugName","updatingObservers","i","observableValue","nameOrOwner","initialValue","debugNameData","ObservableValue","_tx","observableFromEvent","args","event","getValue","FromEventObservable","_getValue","_getTransaction","didRunTransaction","batchEventsGlobally","didSet","KeepAliveObserver","_forceRecompute","_handleValue","consoleObservableLogger","logObservableToConsole","ConsoleObservableLogger","text","consoleTextToArgs","normalText","repeat","styled","formatValue","formatKind","changes","changedObservables","transactionName","styles","firstArg","process","t","item","kind","padStr","objToCss","styleObj","styleString","propName","propValue","style","availableLen","formatValueUnsafe","formatArray","formatObject","first","val","entries","str","length","debugNamePostProcessor","Info","formatObservableInfo","indentLevel","alreadyListed","indent","dep","sourceObj","type","dependencies","stableStringify","v","k","inputPropertyKey","aggregateInputProperties","components","groups","order","component","group","g","effectiveInputValue","override","STORAGE_KEY","FixtureInputStore","__publicField","fixtureId","values","propSchema","next","raw","parsed","FixturePath","VIEWPORT_SIZES","resolveViewport","preset","validatePath","path","computePathSegments","filePath","pathOption","baseName","extractBaseName","prefix","createFixtureTree","fixtures","root","fixtureExport","skeletonNode","segments","addFixtureExportToTree","pathSegments","pathPrefix","current","accumulatedPath","folderName","folderId","folder","c","finalSegment","fullId","def","componentNode","entry","own","ownArr","groupVisualDescriptions","groupInputSchema","variantsNode","variant","variantVisualDescriptions","variantInputSchema","childId","findNodeByPath","segment","collectComponents","node","FixtureRegistry","tree","ManualChangesHandler","_run","_change","PropertyTransformerFactory","propConst","PropertyConstTransformerFactory","propObs","PropertyObsTransformerFactory","readableProp","_reader","isObservable","mapObject","ViewModelContextSymbol","BaseViewModel","props","getOrCreateViewModelContext","createContext","ViewModel","renderingCount","batchedUpdater","potentialChanges","rendering","unstable_batchedUpdates","viewIdx","ViewImpl","debugName","renderFactory","obsView","componentName","render","contexts","plusOne","x","createVM","forceUpdate","useReducer","useState","ctx","useContext","useEffect","view","p","readableProps","propValues","collectRequiredContexts","propsDesc","viewWithModel","viewModelCtor","propsOrRender","maybeRender","modelPropsDesc","requiredContexts","viewModelContext","allContexts","getContextValues","contextValues","providedModel","readableModelProps","model","modelProps","m","toExplorerTree","nodeMatches","lowerQuery","label","filterTree","query","filterNode","selfMatches","filteredChildren","filtered","createLocalStorageObservable","storageKey","defaultValue","serialize","deserialize","stored","originalSet","createQueryParamObservable","paramName","search","newUrl","buildQueryParamUrl","MIN_VIEWPORT_SIZE","MAX_VIEWPORT_SIZE","clampDimension","fallback","clampViewportIndex","pageMode","isPagePreviewMode","defaultViewport","viewportIndex","resolveSettings","calculatePagePreviewGeometry","settings","availableWidth","availableHeight","usableWidth","usableHeight","logicalWidth","logicalHeight","scale","FixtureViewportStore","viewport","width","height","mode","FixtureDebugStore","nextNodeId","createDebugWorkbenchLayout","entryKeys","activeEntryKey","createStack","getDebugWorkbenchEntryOrder","getVisibleDebugEntryKeys","visitStacks","getFirstDebugStackId","reconcileDebugWorkbenchLayout","allowedKeys","pruneEntries","presentKeys","missingKeys","firstStackId","firstStack","findStack","replaceStack","activateDebugEntry","entryKey","mapStacks","reorderDebugEntry","targetEntryKey","before","targetStack","findStackContaining","withoutEntry","removeEntry","currentTargetStack","insertAt","dockDebugEntry","targetStackId","zone","sourceStack","currentTarget","newStack","horizontal","split","createNodeId","replaceNode","updateDebugSplitRatio","splitId","ratio","clampRatio","second","mapper","visitor","stackId","replacement","nodeId","DebugWorkbenchStateStore","workbenchId","layout","activeEntry","ExplorerModel","report","selectedNode","rows","row","sessionName","daemon","url","newSet","selected","parts","expanded","nodes","found","childPath","items","reportState","mergeStyles","styleObjects","TitleBarButtonModel","hovered","TitleBarButton","isHovered","active","buttonStyle","jsx","ChevronRightIcon","ChevronDownIcon","ComponentIcon","FolderIcon","PanelLeftIcon","PanelRightIcon","SunIcon","MoonIcon","ViewModeSelector","viewMode","sessions","currentSession","otherSessions","jsxs","viewModeStyles","ViewModeButton","onClick","TitleBar","leftVisible","rightVisible","isDarkTheme","Fragment","labelContainerStyle","countFixtures","sum","labelBadgeStyle","TreeView","TreeItem","TreeItemModel","itemModel","depth","hasChildren","isExpanded","isSelected","itemStyle","searchContainerStyle","searchInputStyle","searchWrapperStyle","clearButtonStyle","SearchInput","LeftSidebar","readSharedValue","property","describeType","renderControl","mixed","setValue","option","el","PropertyControl","fixtureIds","RightSidebar","f","candidate","emptyStyle","renderEventTypeSchema","z","renderEventSchema","coverageRefSchema","buildExplorerUrl","params","queryString","base","MAX_ENTRIES","createHeightCache","_cache","load","save","_rowHeights","_contentHeights","setCachedHeight","getAllCachedHeights","setCachedContentHeight","getCachedContentHeight","_contentWidths","setCachedContentWidth","getCachedContentWidth","_nextEventId","_ConsoleEventsStore","reason","ConsoleEventsStore","OUTPUT_DEBUG_PANEL_ID","FixtureInputRuntime","_input","listener","listeners","readProperty","disposed","changedKeys","getChangedKeys","FixtureDebugRuntime","panelId","activate","output","isInteractiveOutput","publish","actionListeners","channel","activation","provider","session","action","isRecord","previous","previousRecord","nextRecord","RENDER_TIMEOUT_MS","isPromise","injectStyles","targetDoc","injectedElements","adoptedSheets","appendTarget","styleEl","linkEl","removeStyles","sheet","s","ComponentRendering","host","_renderHost","isolation","effectiveInput","shadowRoot","iframe","isComponentMode","resolveRendered","rejectRendered","onMessage","_e","_f","_g","sessionId","_h","resolve","reject","rawResult","context","panel","resolved","timeoutPromise","_","errors","captureError","promises","runDispose","fixtureDispose","_shadowHost","setExplorerShadowHost","getExplorerShadowHost","_fixtureContainers","_originalFocus","isInsideFixtureContainer","registerFixtureContainer","container","ConsolePanelModel","ConsolePanel","events","errorCount","panelStyles","ConsoleEventRow","showStack","setShowStack","React","isError","isWarn","timeStr","rowStyles","DebugWorkbenchViewModel","initialEntries","currentEntries","launcher","origins","source","pointerId","startX","startY","dragging","onMove","pointerEvent","onUp","rect","update","stop","element","clientX","clientY","dockTarget","getDockZone","targetTab","selector","reconciled","workbenchEntriesEqual","toolbar","tab","origin","left","right","isConsoleEntry","DebugWorkbench","contentVisible","externalHeaderHost","debugToolbarStyle","debugTabStyle","PopOutLink","debugWorkbenchStyle","createPortal","layoutRootStyle","renderLayoutNode","topEdge","rightmostTopEdge","renderStack","firstSize","secondSize","splitStyle","splitterStyle","dropTarget","draggedEntryKey","activeDropZone","visibleEntryKeys","stackStyle","renderStackHeader","stackContentStyle","DebugPanelSurface","renderDockOverlay","topEdgeStackHeaderStyle","localStackHeaderStyle","visibleDebugTabStyle","draggingDebugTabStyle","headerActionsStyle","CloseButton","href","headerActionStyle","headerActionButtonStyle","activeZone","zones","dropPreviewStyle","getDropPreviewPosition","dropPreviewLabelStyle","dockOverlayStyle","dockTargetStyle","getDockTargetPosition","activeDockTargetStyle","DebugPanelSurfaceViewModel","readyInfo","createLightDomPanelRenderTarget","disposeResource","createRoot","mountOutputJsonPanel","mountCustomDebugPanel","panelSurfaceStyle","surface","rootNode","explorerHost","slotName","slot","renderContainer","definition","editable","OutputJsonPanel","OutputJsonPanelViewModel","outputJsonContainerStyle","outputJsonTextareaStyle","outputJsonErrorStyle","y","edge","candidates","getDockTargetGlyph","getDockTargetGlyphBackground","color","resource","resolveDebugPanelPlacement","explicitPlacement","logicalFixtureCount","buildEmbeddedUrl","_nextSlotId","FixturePreviewItemModel","measure","canvas","canvasStyle","horizontalPadding","verticalPadding","chromeHeight","paneWidth","minPaneWidth","minFixtureWidth","maxPaneWidth","clampedPaneWidth","shadowHost","fixtureContainer","displayMode","FixturePreviewItem","measuredWidth","measuredHeight","compact","pageSettings","pageGeometry","dimensionsText","wrapperStyle","previewItemStyles","nameStyle","debugInfo","debugEntries","getInlineDebugEntries","activeDebugEntryKey","debugPaneOpen","contentHostWidth","fixtureColumnHeight","usableDebugWidth","debugPaneWidth","collapsedFixtureWidth","fixtureColumnWidth","fallbackDebugHeight","debugHeight","tabPanelId","getLabelRowStyle","PageViewportControls","renderToolbarInputControls","EmbeddedIcon","getDebugContentStyle","getCanvasStyle","getPageFrameStyle","getPageScaleLayerStyle","FixtureError","hasOutput","outputEditable","controls","schemaProperties","geometry","selectedViewport","usesSelectedViewport","selectedValue","DimensionInput","disabled","onCommit","commit","CHECKER_SIZE","createCheckerPattern","baseColor","checkerColor","lightPattern","darkPattern","canvasBaseStyle","background","pattern","hasDebugEntries","setExpanded","errorStyles","FixtureScreenshotModel","version","FixtureScreenshotView","screenshotStyles","SingleComparisonModel","sourceTreeIds","baselineStId","currentStId","SingleComparison","status","statusBadge","compStyles","ScreenshotComparisonRow","ScreenshotImage","src","alt","ReportFixtureView","reportModel","hasScreenshots","ReportComparisonRow","ESTIMATED_ROW_HEIGHT","ROW_GAP","CONTENT_PADDING","OVERSCAN_PX","SCROLL_ANCHOR_KEY","MAX_ANCHOR_ENTRIES","loadScrollAnchors","saveScrollAnchor","anchor","all","pruned","getScrollAnchor","getRowId","computeLayout","heightCache","top","layoutTotalHeight","last","findFirstVisibleRow","lo","hi","mid","computeVisibleRange","scrollTop","viewportHeight","start","end","bottom","computeAnchor","idx","rowIndex","scrollTopForAnchor","getRowPath","getPathSegments","computeNewHeadings","rowId","idSegments","offset","j","headingTags","headingTagForDepth","headingFontSizes","headingStyleForDepth","PreviewAreaModel","heights","h","prevObsScrollTop","newScrollTop","delta","newMap","changedRows","rid","oldLayout","scrollTopBefore","newLayout","PreviewArea","selectedNodeId","availablePageHeight","total","currentSegments","prevSegments","newHeadings","Tag","VariantsRowView","BottomDebugPanelModel","BottomDebugPanel","panelModel","collectFixtureEntries","counts","typeId","consoleEvents","consoleEventsStore","loadingStyle","spinnerStyle","Explorer","loading","themeClass","AsyncStream","_AsyncStream","iterator","ApiError","statusCode","method","ProxyApiClient","_request","_target","_self","createFetchClient","baseUrl","arg","data2","msg","contentType","buffer","decoder","done","eolIndex","finalLine","DaemonModel","config","sourceTreeId","cacheKey","baselineSessionName","currentSessionName","baselineSourceTreeId","currentSourceTreeId","map","sessionList","signal","stream","expectedDaemonApiVersion","SemanticVersion","actualDaemonApiVersion","neededByPlugin","runtimeVersion","ReportModel","reportUrl","lastSlash","relativePath","buildTreeFromFixtureIds","response","isLeaf","labels","ExplorerUIMode","loadFixtures","daemonConfig","modules","shadow","explorerCss","darkThemeCss","lightThemeCss","uiContainer","createElement","fixtureModules","module","HeadlessMode","_containerElement","disposeErrors","allIds","suggestions","findClosestMatches","suggestionText","previousDisposeReport","setError","startTime","syncTimeMs","totalTimeMs","hasError","renderTimeMs","previousDispose","originalError","originalWarn","originalLog","stackFromArgs","errorHandler","rejectionHandler","groupPath","inheritedLabels","effectiveLabels","results","nextPath","api","levenshteinDistance","la","lb","dp","EmbeddedMode","_container","_fixtureId","loadSourceModule","request","postSize","parseExplorerQueryParams","ExplorerApp","buildInfo","file","fixturesPromise"],"mappings":";;;;;;;;;;;AAmCO,SAASA,GAAgBC,GAA8C;AAC5E,SACE,OAAOA,KAAU,YACjBA,MAAU,QACVC,MAAsBD,KACrBA,EAAkCC,EAAkB,MAAM,MAC3D,cAAcD,KACd,OAAQA,EAAgC,YAAa;AAEzD;AAMO,SAASE,GAAeF,GAA6C;AAC1E,SACE,OAAOA,KAAU,YACjBA,MAAU,QACVG,MAAqBH,KACpBA,EAAkCG,EAAiB,MAAM,MAC1D,cAAcH,KACd,OAAQA,EAAgC,YAAa;AAEzD;AAMO,SAASI,GAAkBJ,GAAgD;AAChF,SACE,OAAOA,KAAU,YACjBA,MAAU,QACVK,MAAwBL,KACvBA,EAAkCK,EAAoB,MAAM,MAC7D,eAAeL,KACf,OAAQA,EAAiC,aAAc;AAE3D;AAqBO,SAASM,GAAmBN,GAA4C;AAC7E,SAAID,GAAgBC,CAAK,IAChB,EAAE,SAAS,IAAM,MAAMA,EAAA,IAE5BE,GAAeF,CAAK,IACf,EAAE,SAAS,IAAM,MAAMA,EAAA,IAE5BI,GAAkBJ,CAAK,IAClB,EAAE,SAAS,IAAM,MAAMA,EAAA,IAEzB,EAAE,SAAS,IAAO,OAAO,4FAAA;AAClC;AAKO,SAASO,GAAmBP,GAAkD;AACnF,SAAID,GAAgBC,CAAK,IAChB,EAAE,SAAS,IAAM,MAAMA,EAAA,IAEzB,EAAE,SAAS,IAAO,OAAO,qCAAA;AAClC;AAKO,SAASQ,GAAkBR,GAAiD;AACjF,SAAIE,GAAeF,CAAK,IACf,EAAE,SAAS,IAAM,MAAMA,E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