import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{DialogCloseReason}from'../../overlays/dialog/dialog.class.js';import{type DocumentRendererRegistry,type LyraDocumentRendererPayload}from'./registry.js';import type{AnchorResultDetail,LyraAnchor,LyraHighlight}from'./anchors.js';export type DocumentViewerCloseReason=DialogCloseReason;export interface LyraDocumentViewerEventMap{'lr-close':CustomEvent;'lr-download':CustomEvent<{src:string;filename:string;}>;'lr-anchor-result':CustomEvent;'lr-render-error':CustomEvent<{error:unknown;}>;} /** * A dialog-hosted document viewer with a pluggable MIME-type renderer registry. * A registered renderer receives the current file; files without a matching * renderer use `` as a safe built-in fallback. Each instance snapshots the * registered built-ins at construction; an explicit readonly `registry` provides deterministic * overrides, and MIME dispatch ignores casing and parameters. An opt-in immutable `payload` * becomes authoritative for the file when set; scalar file properties remain the compatible * default when it is unset. * A host `aria-label` names the nested dialog by attribute presence, including an explicitly * empty value; `name` remains the visible dialog heading. * * 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-document-viewer * @event lr-close - Fired when the viewer's shell dialog dismisses the viewer. The detail is the * dialog close reason. A registered renderer's own descendant dialog keeps its independent * `lr-close` path (guarded by `event.target !== event.currentTarget`) and does not close this * viewer. * @event lr-download - Fired when the viewer's safe download action is * activated. The browser download itself is handled by the native link. * @event lr-anchor-result - Fired once per applied `anchor`. An incapable resolved renderer * produces `{ found: false }`; the `` fallback reports its actual anchor * result. An anchor-capable renderer reports its own jump result through its embedded * `DocumentAnchorTarget` mixin, which composes up through this element unchanged. * @event lr-render-error - Fired by the fallback preview or an embedded renderer when fetching, * parsing, sanitizing, or rendering fails. `detail: { error }` composes through this shell * unchanged. * @csspart body - Wrapper around the active renderer or fallback preview. It exposes explicit * `aria-busy`; visible loading/error text is ordinary content and transitions announce through * the shared document-level polite/assertive sinks. * @csspart download-link - The native download action shown when `src` is safe. * @cssprop [--lr-document-viewer-max-height=70vh] - Maximum block size of the dialog body before it scrolls internally. * @cssprop [--lr-document-viewer-min-height=var(--lr-size-12rem)] - Minimum block size of the * dialog body before it grows to fit content. * @cssprop [--lr-document-viewer-width=auto] - Assertive inline size for the nested dialog panel, * forwarded to ``'s own `--lr-dialog-width`. Left at `auto` the panel shrink-wraps to * content, capped by the dialog's own `--lr-dialog-max-width` tier -- set this instead of * reaching through to `--lr-dialog-width` directly, which remains an internal implementation * detail of the nested dialog. * @cssprop [--lr-document-viewer-download-link-hover-bg=color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-hover))] - Hover background of the download link. * @cssprop [--lr-document-viewer-download-link-active-bg=color-mix(in oklab, var(--lr-color-brand), var(--lr-color-mix-partner) var(--lr-color-mix-active))] - Pressed background of the download link. * @status stable * @since 4.0.0 */ export declare class LyraDocumentViewer extends LyraElement{protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[]; /** Whether the viewer is open. */ open:boolean; /** Display name passed to the renderer and shown as the dialog heading. A host `aria-label` * independently overrides the nested dialog's accessible name by attribute presence. */ name:string; /** MIME type used for renderer dispatch. */ mimeType:string; /** Source URL passed to the renderer or fallback preview. */ src:string;private _payload?; /** * Optional renderer-specific file payload. Assignment clones, bounds, and freezes the complete * snapshot immediately. While set, `payload.file` is authoritative for dispatch, heading, * renderer/fallback input, and download; `name`, `mimeType`, `src`, `anchor`, `highlights`, and * `alt` resume their legacy authority when this is reset to `undefined`. */ get payload():LyraDocumentRendererPayload|undefined;set payload(value:LyraDocumentRendererPayload|undefined);private registrySource?;private _registry?; /** Optional per-instance immutable/read-only registry override. Native maps and definition * records are synchronously cloned and frozen while callback identities are retained; later * source-map mutation is not observed. Factory-created immutable registries use the same bounded * snapshot boundary. When unset, this instance owns a snapshot of the built-ins * that existed when it was constructed; later registrations cannot mutate it. A consumer matcher * or renderer that throws is contained as the localized error state, and a pending anchor * completes once with `{ found: false }`. */ registry?:DocumentRendererRegistry; /** Declarative scroll-to-anchor target, forwarded to the resolved renderer. A string is a * highlight id in `highlights`. `hasChanged: () => true` so re-assigning the same value (e.g. * re-clicking the same citation badge) still re-fires, mirroring the anchor-target mixin's * identical property. */ anchor:LyraAnchor|string|null;private _highlights; /** Highlights forwarded to the resolved renderer. IDs are trimmed, nonempty, and first-wins. */ get highlights():readonly LyraHighlight[];set highlights(value:readonly LyraHighlight[]); /** Media alt text forwarded to the resolved renderer, for image-like renderers. Unset lets the * renderer derive a fallback name; an explicit empty string marks decorative media. */ alt?:string;private renderState;private generation;private readonly builtInRegistry;private resolvedLazy?;private fallbackPreviewEl?;private readonly announcements;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private currentFile;private resolve; /** Consumer registries are extension points, so a throwing matcher/renderer must fail like a * rejected lazy loader instead of escaping `resolve()` as an unhandled rejection. */ private failResolution; /** Delegates to the fallback preview and emits its actual anchor result when there is no resolved * renderer. Otherwise the shell emits `lr-anchor-result { found: false }` when the renderer * cannot honor `file.anchor`'s kind (or, for a highlight-id anchor, declares no anchor * capability at all). A capable embedded viewer's own `DocumentAnchorTarget` mixin emits after * its scroll attempt and that composed event surfaces through this element unchanged, so the * shell must not also emit in that case. */ private finishAnchorResult;private isAnchorCapable;private renderWith;private onDialogClose;private onDownload;private renderBody;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-document-viewer':LyraDocumentViewer;}}