import type { Wafer } from '../core/wafer.js';
import type { Die } from '../core/dies.js';
import { type BinDef, type TestDef, type YieldSummary } from '../renderer/buildWaferMap.js';
import type { StatsFinding, StatsSummary, LotStatsSummary } from '../stats/types.js';
import { type FindingsFilter } from '../stats/filterFindings.js';
import { buildWarningsBanner, type WaferWarning } from './warnings.js';
export { buildWarningsBanner };
import { type SaveTextHandler } from './toolbar.js';
export interface SummaryPanelOptions {
    /** Which side of the content area to place the panel. Default 'right'. */
    placement?: 'right' | 'left' | 'top' | 'bottom';
    /** Open the panel immediately on render without requiring the user to click the toolbar button. Default false. */
    defaultOpen?: boolean;
}
/** Order-preserving [key, value] pairs from a metadata-like record, with
 *  null/undefined/empty-string entries dropped. The single source of truth
 *  for "what counts as a displayable metadata field" — shared by the map
 *  metadata badge and `buildMetadataStripRow`/`buildFacetSummaryChips` so
 *  they can't drift on what they consider "no metadata". */
export declare function metadataEntries(meta: Record<string, unknown>): Array<[string, string]>;
/** Single-line, wrap-when-needed "Label: value1, value2 [+N more]" chips —
 *  the gallery's top-of-grid strip summary over a whole (possibly multi-lot)
 *  population, one chip per `FacetField` from `stats/facets.ts`'s
 *  `buildFacetTable`. Shows every distinct value a field takes
 *  across the population — so a mixed-lot gallery still surfaces "Lot:
 *  LOT123, LOT456" instead of silently dropping a field the moment it
 *  varies. `field.values` is already sorted by coverage (`buildFacetTable`),
 *  so the values shown inline are the most common ones. Labels use
 *  `prettyKey(field.key)`, not `field.label` — `DEFAULT_FACET_CURATION`'s own
 *  labels (e.g. "Program") differ from the `prettyKey` convention every other
 *  metadata surface in this library uses ("Test Program"), and this strip
 *  must read as the same field as those surfaces, not a differently-named one.
 *  Returns `null` for an empty table. */
export declare function buildFacetSummaryChips(table: Array<{
    key: string;
    values: Array<{
        value: string;
    }>;
}>, maxValuesPerField?: number): HTMLDivElement | null;
export interface MetadataStripStacked {
    lotSize: number;
    aggrMethod?: string;
}
/** The single correct way to summarize a population's identity as an
 *  always-visible strip: computed via `buildFacetTable`/`buildFacetSummaryChips`
 *  over every item's own metadata, so a field that varies across items (e.g. a
 *  lot with mixed `split` values) shows every distinct value it takes — never
 *  silently collapsed to one item's value (e.g. `analyzeWaferLot`'s
 *  first-wafer-wins `lot` field), which misrepresents the population (see
 *  CLAUDE.md: aggregated/filtered populations must be identified). Shared by
 *  the gallery legend strip and the Insights header strip so the two surfaces
 *  can't drift on content or field order again. Returns `null` when there's
 *  nothing to show. */
export declare function buildMetadataStripRow(items: Array<{
    metadata?: Record<string, unknown>;
}>, stacked?: MetadataStripStacked, options?: {
    facetableOnly?: boolean;
}): HTMLDivElement | null;
/** `buildMetadataStripRow` wrapped in the boxed-strip chrome every
 *  standalone, always-visible metadata strip uses (border/background/shadow
 *  — the same look as the gallery legend strip). Not used by the gallery
 *  legend itself, which stacks a bin-swatch row inside the same box below
 *  the metadata row and so builds its own box around both rather than two
 *  nested boxes — that caller uses `buildMetadataStripRow` directly. */
export declare function buildMetadataStripBox(items: Array<{
    metadata?: Record<string, unknown>;
}>, stacked?: MetadataStripStacked, options?: {
    facetableOnly?: boolean;
}): HTMLDivElement | null;
/** Same row visual language as `metaRow`/`prettyKey`, one field per line —
 *  for the metadata badge's expand-on-click popover, where each field
 *  reading on its own line is more legible than wrapped inline chips and the
 *  cost is only paid while the popover is open, not by default.
 *  Returns `null` for empty input. */
export declare function buildCompactMetadataRows(meta: Record<string, unknown>): HTMLDivElement | null;
/**
 * The single source of metadata display in the Summary panel — used by both
 * the single-wafer and lot paths, always built via `buildMetadataStripRow`/
 * `buildFacetTable` (the same function the gallery legend strip and Insights
 * header strip use) rather than reading `wafer.metadata` directly (drifts
 * from the strip's truncation/formatting) or `LotStatsSummary.lot`
 * (`analyzeWaferLot`'s first-wafer-wins field, which silently collapses any
 * field that varies across the lot to one wafer's value — see CLAUDE.md on
 * identifying aggregated populations). A population of one wafer is just a
 * facet table where every field has exactly one value, so the single-wafer
 * and lot panels can never render different content for the same
 * underlying metadata.
 */
export declare function buildMetadataInfoSection(items: Array<{
    metadata?: Record<string, unknown>;
}>, stacked?: MetadataStripStacked): HTMLDivElement | null;
export declare function buildYieldSection(yieldSummary: YieldSummary, dataCoverage: {
    filledDies: number;
    totalDies: number;
    edgeExcludedDies: number;
    ratio: number;
}, passBins?: number[]): HTMLDivElement;
export declare function buildBinSection(dies: Die[], binDefs: BinDef[] | undefined, mode: 'hard' | 'soft', colorScheme?: string, 
/**
 * Precomputed counts (e.g. `StatsSummary.stats.hardBinCounts`/`.softBinCounts`,
 * already scoped to the yield-eligible population) — used directly instead
 * of re-walking `dies` when supplied.
 */
precomputedCounts?: Record<number, number>): HTMLDivElement | null;
/** Aggregate bin counts across all wafers in the lot — no lot-pooled
 *  precomputed bin counts exist (`hardBinCounts`/`softBinCounts` are
 *  per-wafer only), so this scans the pooled `Die[]` directly, same as
 *  `buildBinSection` does when it has no `precomputedCounts`. */
export declare function buildLotBinSection(allDies: Die[], binDefs: BinDef[] | undefined, mode: 'hard' | 'soft', colorScheme?: string): HTMLDivElement | null;
export declare function buildRingSection(dies: Die[], wafer: Wafer, ringCount: number, passBins: number[]): HTMLDivElement | null;
export declare function buildQuadrantSection(dies: Die[], wafer: Wafer, ringCount: number, passBins: number[]): HTMLDivElement | null;
/** Aggregate ring yield across all wafers in the lot. */
export declare function buildLotRingSection(diesByWafer: Die[][], allWafers: Wafer[], ringCount: number, passBins: number[]): HTMLDivElement | null;
/** Aggregate quadrant yield across all wafers in the lot. */
export declare function buildLotQuadrantSection(diesByWafer: Die[][], allWafers: Wafer[], ringCount: number, passBins: number[]): HTMLDivElement | null;
/** Lot overview — wafer count and mean (unweighted arithmetic mean of each
 *  wafer's own yield%, not a die-weighted lot yield — see CLAUDE.md on
 *  correctly labelling aggregation methods) wafer yield. Metadata is a
 *  separate section (`buildMetadataInfoSection`) built from the lot's own
 *  items, not from `lotSummary.lot` — see that function's doc comment. */
export declare function buildLotOverviewSection(lotSummary: LotStatsSummary): HTMLDivElement;
/** Per-wafer yield bars, absolute 0–100% scale, with a median marker line and
 *  below-median wafers muted — lets an engineer spot outlier wafers within
 *  the lot at a glance. */
export declare function buildPerWaferYieldSection(lotSummary: LotStatsSummary, items: Array<{
    label?: string;
} | null>, onWaferClick?: (waferIndex: number) => void): HTMLDivElement | null;
/** CSV field escaper — exported so `dieList.ts` shares it rather than a second copy. */
export declare function csvField(value: string): string;
export declare function buildTestSection(dies: Die[], testDefs: TestDef[] | undefined, fallbackFormat?: 'si' | 'engineering', 
/**
 * When supplied, each test's descriptive stats and spec-yield are read from
 * `.perTestStats`/`.testSpecYield` (already computed once by
 * `analyzeWaferMap`, or pooled across a lot by `buildLotTestSection`)
 * instead of re-scanning `dies`. A test falls back to a raw-die scan when
 * it's missing from `perTestStats` entirely, or when `stddev`/`median`/
 * `q1`/`q3` weren't included (e.g. lot pooling, which can reconstruct
 * min/max/mean/count exactly across wafers but not quantiles — see
 * `buildLotTestSection`'s doc comment). Structurally a subset of
 * `StatsSummary['stats']`, so a real `StatsSummary` can be passed directly.
 */
precomputedTestStats?: {
    perTestStats?: Array<{
        testNumber: number;
        min: number;
        max: number;
        mean: number;
        count: number;
        stddev?: number;
        median?: number;
        q1?: number;
        q3?: number;
    }>;
    testSpecYield?: Array<{
        testNumber: number;
        totalDies: number;
        yieldPercent: number | null;
    }>;
}, 
/** Optional host hook for the "Export CSV" button — see `saveTextFile` (toolbar.ts). */
onSaveText?: SaveTextHandler): HTMLDivElement | null;
/**
 * "Functional Tests" section — one row per functional (`testType: 'F'`) test
 * with pass/fail counts and pass rate. The functional counterpart of
 * `buildTestSection`, which shows parametric statistics functional tests are
 * excluded from. Shared by the Summary panel, the Insights Overview tab, and
 * the pooled lot variant (`buildLotFunctionalSection`).
 *
 * `precomputed` takes `StatsSummary.stats.functionalYield` (already computed
 * by `analyzeWaferMap`, or pooled by `buildLotFunctionalSection`); without it
 * the rows are computed from `dies` via `computeFunctionalYield`, so both
 * paths share one computation.
 */
export declare function buildFunctionalTestSection(dies: Die[], testDefs: TestDef[] | undefined, precomputed?: NonNullable<StatsSummary['stats']['functionalYield']>, 
/** Optional host hook for the "Export CSV" button — see `saveTextFile` (toolbar.ts). */
onSaveText?: SaveTextHandler): HTMLDivElement | null;
/**
 * Lot-pooled "Functional Tests" section: when every wafer's
 * `StatsSummary.stats.functionalYield` is available, sums pass/fail/total
 * counts across wafers (exact — counts pool losslessly, unlike quantiles);
 * otherwise recomputes from the pooled dies.
 */
export declare function buildLotFunctionalSection(allDies: Die[], testDefs: TestDef[] | undefined, perWaferSummaries?: StatsSummary[], onSaveText?: SaveTextHandler): HTMLDivElement | null;
export declare function buildFindingsSection(findings: StatsFinding[], statsSummary: StatsSummary | LotStatsSummary, onFindingClick: (finding: StatsFinding, row: HTMLButtonElement) => void, activeFindingId: string | null, 
/**
 * When true, skips the collapsible "Findings" header/badge and renders
 * content directly — used by `buildFindingsSectionWithFilter`, which
 * builds its own collapsible wrapper (header + filter row) around this.
 * Default false (collapsible-section behavior, used when this is one
 * section among several, e.g. inside the Insights Overview tab's legacy
 * embedding).
 */
standalone?: boolean): HTMLDivElement | null;
/**
 * Findings section with severity/kind/region filter controls — the
 * panel-level entry point (wraps `buildFindingsSection(..., standalone:
 * true)` in its own collapsible "Findings" header + filter row). Returns
 * `null` when the source has no findings at all (nothing to filter).
 */
export declare function buildFindingsSectionWithFilter(source: StatsSummary | LotStatsSummary, onFindingClick: (finding: StatsFinding, row: HTMLButtonElement) => void, activeFindingId: string | null, filter: FindingsFilter, onFilterChange: () => void): HTMLDivElement | null;
/**
 * Aggregate test value stats across all wafers in the lot. When every
 * wafer's `StatsSummary.stats.perTestStats`/`.testSpecYield` is available
 * (`perWaferSummaries`), pools mean (n-weighted)/min/max and sums spec
 * pass/fail counts directly from those instead of re-scanning `allDies` —
 * exact, since these are the same per-wafer aggregates `analyzeWaferMap`
 * already computed once each. (Quartiles/median aren't pooled this way —
 * they aren't reconstructable from per-wafer quartiles alone — but
 * `buildTestSection`'s display doesn't need them.)
 */
export declare function buildLotTestSection(allDies: Die[], testDefs: TestDef[] | undefined, fallbackFormat?: 'si' | 'engineering', perWaferSummaries?: StatsSummary[], 
/** Optional host hook for the "Export CSV" button — see `saveTextFile` (toolbar.ts). */
onSaveText?: SaveTextHandler): HTMLDivElement | null;
export declare function createSummaryPanelEl(placement: 'right' | 'left' | 'top' | 'bottom'): HTMLDivElement;
/** Wrap the canvas + panel in a flex container according to placement. */
export declare function wrapWithSummaryPanel(content: HTMLElement, panel: HTMLDivElement, placement: 'right' | 'left' | 'top' | 'bottom'): HTMLDivElement;
/** Render all wafer-level sections into a panel element. Clears existing content. */
export declare function renderWaferSummaryContent(panel: HTMLDivElement, params: {
    wafer: Wafer;
    dies: Die[];
    yieldSummary?: YieldSummary;
    dataCoverage?: {
        filledDies: number;
        totalDies: number;
        edgeExcludedDies: number;
        ratio: number;
    };
    hbinDefs?: BinDef[];
    sbinDefs?: BinDef[];
    testDefs?: TestDef[];
    statsSummary?: StatsSummary;
    /**
     * Warnings to show above the panel. Collected by the renderer via
     * `collectWarnings` so this banner, the toolbar indicator and `onWarning`
     * all show the same set. Falls back to the summary's own analysis warnings
     * when omitted, which is the only set a bare panel could know about.
     */
    warnings?: WaferWarning[];
    passBins?: number[];
    ringCount?: number;
    colorScheme?: string;
    fallbackFormat?: 'si' | 'engineering';
    onFindingClick?: (finding: StatsFinding, row: HTMLButtonElement) => void;
    activeFindingId?: string | null;
    findingsFilter?: FindingsFilter;
    onFindingsFilterChange?: () => void;
    onSaveText?: SaveTextHandler;
}): void;
/** Render lot-level content into the panel. Clears existing content. */
export declare function renderLotSummaryContent(panel: HTMLDivElement, params: {
    lotSummary: LotStatsSummary;
    items: Array<{
        label?: string;
        wafer?: Wafer;
        dies?: Die[];
        statsSummary?: StatsSummary;
    } | null>;
    hbinDefs?: BinDef[];
    sbinDefs?: BinDef[];
    testDefs?: TestDef[];
    passBins?: number[];
    ringCount?: number;
    colorScheme?: string;
    fallbackFormat?: 'si' | 'engineering';
    onFindingClick?: (finding: StatsFinding, row: HTMLButtonElement) => void;
    activeFindingId?: string | null;
    onWaferClick?: (waferIndex: number) => void;
    findingsFilter?: FindingsFilter;
    onFindingsFilterChange?: () => void;
    onSaveText?: SaveTextHandler;
    /** See the wafer panel's `warnings` — collected by the renderer so every surface agrees. */
    warnings?: WaferWarning[];
}): void;
//# sourceMappingURL=summaryPanel.d.ts.map