import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import'../../layout/virtual-list/virtual-list.class.js';import'../../overlays/empty/empty.class.js';import type{LyraScoreThresholds}from'../graph/graph.class.js'; /** A local, non-exported structural copy of the `lr-document-viewer` `LyraAnchor` discriminated * union, declared here (rather than imported) so this component has no build-time coupling to the * viewer stack. Structurally identical to the real thing, so `chunk.anchor` interops with a * `document-viewer.anchor` assignment with no mapping needed. */ type LyraChunkAnchor={kind:'page';page:number;}|{kind:'text-quote';quote:string;prefix?:string;suffix?:string;page?:number;}|{kind:'fragment';id:string;}|{kind:'line-range';start:number;end?:number;}|{kind:'cell-range';sheet?:string;range:string;}|{kind:'cfi';cfi:string;}|{kind:'time-range';start:number;end?:number;}|{kind:'region';page?:number;rect:{x:number;y:number;width:number;height:number;};}|{kind:'node-path';path:readonly(string|number)[];};export interface LyraChunk{id:string;text:string; /** 0-1 relevance. */ score:number;sourceId:string; /** e.g. filename; falls back to localized `untitledSource`. */ title?:string; /** Finite numeric values are locale-formatted for display; string locators stay verbatim. */ page?:string|number; /** Carried through `lr-chunk-open` verbatim. */ anchor?:LyraChunkAnchor;}export interface LyraChunkInspectorEventMap{'lr-chunk-open':CustomEvent>;'lr-expand':CustomEvent<{chunkId:string;expanded:boolean;}>;} /** How `` orders the chunks it was given. */ export type ChunkInspectorSort='score'|'none'; /** * `` — a ranked retrieved-chunks list: relevance score bars with tier tones, * expandable chunk text, and the deep-link event that lands a chunk in `lr-document-viewer`. * Never fetches or ranks and never opens documents itself. Blank chunk identities and later * duplicates are omitted first-wins before sorting, rendering, state, or events. * * Every row-level part is reachable through `::part()` in both rendering paths: above * `virtualize-at` a row lives in the internal ``'s shadow root, and its parts are * re-exported from there under the same names. Row *state* is exposed as an additional part name * (`chunk-current`, `score-current`, `score-fill-`, `text-clamped`) rather than as an * attribute on the part, because Shadow Parts forbids an attribute selector after `::part()` -- * `::part(chunk)[aria-current='true']` is invalid CSS. The equivalent attributes are still present * on the elements. A state part is a second token in the same `part` attribute, so a `[part~="..."]` * (not `[part="..."]`) selector is the one that matches inside a tree. * * Public collection properties take bounded, clone-owned readonly snapshots. Create a new * collection and reassign it after changes; mutating the assigned array does not update the view. * * @customElement lr-chunk-inspector * @event lr-chunk-open - A chunk's title/open button was activated -- the event a host routes * into `lr-document-viewer` (set `src` from `sourceId`, set `anchor`). `detail: { chunkId, * sourceId, anchor? }`. * @event lr-expand - A chunk's text toggle was activated. `detail: { chunkId, expanded }`. * @csspart base - The result wrapper. It owns `role="group"` and the fallback name unless a * non-empty host `aria-label` makes the host the sole overall owner. * @csspart chunk - One chunk row. Carries `role="listitem"` only in the non-virtualized path; * while virtualized the surrounding `` row supplies that role instead. * @csspart chunk-current - Additional part on the `chunk` row matching `activeChunkId`. * @csspart score - The visible percent-score text. * @csspart score-current - Additional part on the current row's `score` line. * @csspart score-bar - The `aria-hidden` score bar track. * @csspart score-fill - The score bar's tone-mapped fill. * @csspart score-fill-success - Additional part on a `score-fill` in the high-score tier. * @csspart score-fill-warning - Additional part on a `score-fill` in the medium-score tier. * @csspart score-fill-danger - Additional part on a `score-fill` in the low-score tier. * @csspart open-button - The chunk's title/open `